How to implement a task scheduling with python multithreading

I have the following data to process. Each case represents a task list, step represents a specific operation step, step data of each case is different, job represents a scheduled task and takes a long time to process. After step1 and step2 execution, job1 needs to be executed. How to use multithreading to process such data, and then when it comes to each case, the current thread hangs when it encounters job1, and then calls job1 only once when all case processes job1, and then the thread continues to execute after the job1 is finished?
case1:step1 step2 job1 step3 step4 job2 step5 --> there are multiple job
case2:step1 step2 job1 step3 step4 step5 job2 step6
case3:step1 step2 step3 --> no job
caseN


your scenario is suitable for using semaphore synchronization threading.Semaphore

-- update 2019.2.27

just learned that python3.2 has introduced threading.Barrier, which is like pthread's barrier in POSIX C, which is more suitable for your scenario. Here's a simple example: https://blog.csdn.net/u013346...

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bebd43-31aa1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bebd43-31aa1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?