How does python's scheduled task framework apscheduler stop tasks?

topic description

there is a code that looks like this:

job = scheduler.add_job(myfunc, "interval", minutes=2)  
job.remove()  
Same, using an explicit job ID:  
  
scheduler.add_job(myfunc, "interval", minutes=2, id="my_job_id")  
scheduler.remove_job("my_job_id") 

this is when the script runs, add a task and then remove it?
so after my script runs, how do I find this task to remove it?

ask the master to give me some advice

< H2 > question supplement < / H2 >

means that the script runs. now you turn off the terminal and go to bed . Then open the terminal again the next day . How do you stop this task? Or find this mission? How do I operate on this task?

May.20,2022

in apscheduler, the scheduler object has a get_jobs method, which can get the information of all tasks, which is in the form of a list nested dictionary. The value of ID in the dictionary is the ID of the task. You can find the corresponding ID according to the name of the task, and then pass it to the remove_job method.

>>> scheduler.get_jobs()
[{...},{...}]

add a line of code when the last task is scheduled: scheduler.shutdown (wait=False)

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-1bede75-31ba1.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-1bede75-31ba1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?