You can set a custom checkpoint directory by using the setCheckpointDir(dir) function on the Spark context, which is accessible through ctx.spark_session.sparkContext. Make sure to include ctx as an input parameter to the compute() function of your transform.
Keep in mind that you only need to set the checkpoint directory once. Any subsequent attempt at setting the checkpoint to the same directory will result in RDD errors.
localCheckpoint(eager=True)
The checkpoint() function is used to temporarily store a DataFrame on disk, whereas localCheckpoint() stores them in executor memory. You will not need to set a directory when using localCheckpoint(). Use the eager parameter value to set whether or not the DataFrame is checkpointed immediately (default value is True).