code: def test_progress_api(self):
      with SparkContext() as sc:
          sc.setJobGroup("test_progress_api", "", True)
          rdd = sc.parallelize(range(10)).map(lambda x: time.sleep(100))
  
          def run():
              # When thread is pinned, job group should be set for each thread for now.
              # Local properties seem not being inherited like Scala side does.
              if (
                  os.environ.get("PYSPARK_PIN_THREAD", "true").lower()
                  == "true"
              ):
                  sc.setJobGroup("test_progress_api", "", True)
              try:
                  rdd.count()
              except Exception:
                  pass
  
          t = threading.Thread(target=run)
          t.daemon = True
          t.start()
          # wait for scheduler to start
          time.sleep(3)
  
          tracker = sc.statusTracker()
          jobIds = tracker.getJobIdsForGroup("test_progress_api")
          self.assertEqual(1, len(jobIds))
          job = tracker.getJobInfo(jobIds[0])
          self.assertEqual(1, len(job.stageIds))
          stage = tracker.getStageInfo(job.stageIds[0])
          self.assertEqual(rdd.getNumPartitions(), stage.numTasks)
  
          sc.cancelAllJobs()
          t.join()
          # wait for event listener to update the status
          time.sleep(1)
  
          job = tracker.getJobInfo(jobIds[0])
          self.assertEqual("FAILED", job.status)
          self.assertEqual([], tracker.getActiveJobsIds())
          self.assertEqual([], tracker.getActiveStageIds())
  
          sc.stop()
  
imports: import os
  import shutil
  import stat
  import tempfile
  import threading
  import time
  import unittest
  from collections import namedtuple
  from pyspark import SparkConf, SparkFiles, SparkContext
  from pyspark.testing.utils import ReusedPySparkTestCase, PySparkTestCase, QuietTest, SPARK_HOME
label_desc: Use image node_id 9 for calling the ContextTests obj's underlying member method code with example usage: obj.test_progress_api() without return types