I am trying to figure out whether APScheduler is the tool for my project's needs.
I can add a job.
I can get a list of jobs -- but I am having trouble interpreting the results. I want to have my program translate this returned job list into a format needed by other parts of the program. I need to extract the trigger parameters.
Let's say I'm using a cron trigger. I'll make a simple one for now:
new_job = self.scheduler.add_job(jobfunc,'cron', minute='*/5', args=["minute"]
Later, I want to get the jobs and then extract the basic information (this is a cron trigger, that it is scheduled for 'minute'=*/5) -- basically I want to reconstruct the parameters with which I created the trigger.
I have looked at the jobs returned in the debugger, and I see that each job has a "trigger" member which has within it the information I need -- but I am not sure how to access it programmatically.
I would like to do something like this:
jobs=self.scheduler.get_jobs()
schedules=[]
for job in jobs:
schedules.append(<do something with job.trigger.fields>)
Where the element appended to schedules would look something like:
{'minute':'*/5'}
The documentation says:
To get a machine processable list of the scheduled jobs, you can use the get_jobs().
The question is, how should my 'machine' process this list?