shearichard
shearichard

Reputation: 8372

apscheduler.add_job how can I use the trigger parameter?

I'm using apscheduler .

I don't really understand the 'add_job' method .

This works fine :

job = scheduler.add_job( my_housekeeping_function,
                        'interval',
                        kwargs={'config':config},
                        seconds=60,
                        )

but I don't understand how the argument 'interval' (which I'm using succesfully) matches what is shown in the documentation : https://apscheduler.readthedocs.io/en/latest/modules/schedulers/base.html#apscheduler.schedulers.base.BaseScheduler.add_job .

It does seem that the second argument can be a 'str' (although as far as I can tell there's no indication of what are valid values), however there's indication that I can include a keyword argument of 'seconds' but when I do it all works .

Can anyone explain ?

Upvotes: 0

Views: 6093

Answers (1)

Alex Grönholm
Alex Grönholm

Reputation: 5911

Where did you look for the documentation? In the official API documentation, the valid values are listed right in the description of add_job(). The same list can also be found in the User Guide.

What's happening here is that APScheduler looks up the corresponding setuptools entry point from the apscheduler.triggers namespace. The canonical list of built-in triggers can be found in setup.py.

Upvotes: 1

Related Questions