The watcher.db.sqlalchemy.job_store Module

The watcher.db.sqlalchemy.job_store Module

class watcher.db.sqlalchemy.job_store.WatcherJobStore(url=None, engine=None, tablename='apscheduler_jobs', metadata=None, pickle_protocol=2, tag=None)[source]

Bases: apscheduler.jobstores.sqlalchemy.SQLAlchemyJobStore

Stores jobs in a database table using SQLAlchemy.

The table will be created if it doesn’t exist in the database. Plugin alias: sqlalchemy :param str url: connection string :param engine: an SQLAlchemy Engine to use instead of creating a new one based on url :param str tablename: name of the table to store jobs in :param metadata: a MetaData instance to use instead of creating a new one :param int pickle_protocol: pickle protocol level to use (for serialization), defaults to the highest available :param dict tag: tag description

add_job(job)[source]

Adds the given job to this store.

Parameters:job (Job) – the job to add
Raises:ConflictingIdError – if there is another job in this store with the same ID
get_all_jobs()[source]

Returns a list of all jobs in this job store. The returned jobs should be sorted by next run time (ascending). Paused jobs (next_run_time == None) should be sorted last.

The job store is responsible for setting the scheduler and jobstore attributes of the returned jobs to point to the scheduler and itself, respectively.

Return type:list[Job]
start(scheduler, alias)[source]

Called by the scheduler when the scheduler is being started or when the job store is being added to an already running scheduler.

Parameters:
  • scheduler (apscheduler.schedulers.base.BaseScheduler) – the scheduler that is starting this job store
  • alias (str|unicode) – alias of this job store as it was assigned to the scheduler
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.