pyspark.TaskContext.stageId

TaskContext.stageId() → int

The ID of the stage that this task belong to.