timApp.celery_sqlalchemy_scheduler package#

Submodules#

timApp.celery_sqlalchemy_scheduler.models module#

class timApp.celery_sqlalchemy_scheduler.models.CrontabSchedule(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model, timApp.celery_sqlalchemy_scheduler.models.ModelMixin

day_of_month#
day_of_week#
classmethod from_schedule(session, schedule)[source]#
hour#
id#
minute#
month_of_year#
property schedule#
timezone#
class timApp.celery_sqlalchemy_scheduler.models.IntervalSchedule(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model, timApp.celery_sqlalchemy_scheduler.models.ModelMixin

DAYS = 'days'#
HOURS = 'hours'#
MICROSECONDS = 'microseconds'#
MINUTES = 'minutes'#
SECONDS = 'seconds'#
every#
classmethod from_schedule(session, schedule, period='seconds')[source]#
id#
period#
property period_singular#
property schedule#
class timApp.celery_sqlalchemy_scheduler.models.ModelMixin[source]#

Bases: object

classmethod create(**kw)[source]#
update(**kw)[source]#
class timApp.celery_sqlalchemy_scheduler.models.PeriodicTask(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model, timApp.celery_sqlalchemy_scheduler.models.ModelMixin

args#
block#
block_id#
crontab#
crontab_id#
date_changed#
description#
enabled#
exchange#
expires#
id#
interval#
interval_id#
kwargs#
last_run_at#
name#
no_changes = False#
one_off#
priority#
queue#
routing_key#
property schedule#
solar#
solar_id#
start_time#
task#
task_id#

Returns the TIM task id. Only valid for tasks added by users.

property task_name#
total_run_count#
class timApp.celery_sqlalchemy_scheduler.models.PeriodicTaskChanged(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model, timApp.celery_sqlalchemy_scheduler.models.ModelMixin

Helper table for tracking updates to periodic tasks.

classmethod changed(mapper, connection, target)[source]#
Parameters
  • mapper – the Mapper which is the target of this event

  • connection – the Connection being used

  • target – the mapped instance being persisted

id#
classmethod last_change(session)[source]#
last_update#
classmethod update_changed(mapper, connection, target)[source]#
Parameters
  • mapper – the Mapper which is the target of this event

  • connection – the Connection being used

  • target – the mapped instance being persisted

class timApp.celery_sqlalchemy_scheduler.models.SolarSchedule(**kwargs)[source]#

Bases: sqlalchemy.ext.declarative.api.Model, timApp.celery_sqlalchemy_scheduler.models.ModelMixin

event#
classmethod from_schedule(session, schedule)[source]#
id#
latitude#
longitude#
property schedule#
timApp.celery_sqlalchemy_scheduler.models.cronexp(field)[source]#

Representation of cron expression.

timApp.celery_sqlalchemy_scheduler.schedulers module#

class timApp.celery_sqlalchemy_scheduler.schedulers.DatabaseScheduler(*args, **kwargs)[source]#

Bases: celery.beat.Scheduler

Changes#

alias of timApp.celery_sqlalchemy_scheduler.models.PeriodicTaskChanged

Entry#

alias of timApp.celery_sqlalchemy_scheduler.schedulers.ModelEntry

Model#

alias of timApp.celery_sqlalchemy_scheduler.models.PeriodicTask

all_as_schedule()[source]#
property info#

override

install_default_entries(data)[source]#
reserve(entry)[source]#

override

It will be called in parent class.

property schedule#
schedule_changed()[source]#
schedules_equal(*args, **kwargs)[source]#
setup_schedule()[source]#

override

sync()[source]#

override

update_from_dict(mapping)[source]#
class timApp.celery_sqlalchemy_scheduler.schedulers.ModelEntry(model, Session, app=None, **kw)[source]#

Bases: celery.beat.ScheduleEntry

Scheduler entry taken from database row.

classmethod from_entry(name, Session, app=None, **entry)[source]#

**entry sample:

{‘task’: ‘celery.backend_cleanup’,

‘schedule’: schedules.crontab(‘0’, ‘4’, ‘*’), ‘options’: {‘expires’: 43200}}

is_due()[source]#

See is_due().

model_schedules = ((<class 'celery.schedules.crontab'>, <class 'timApp.celery_sqlalchemy_scheduler.models.CrontabSchedule'>, 'crontab'), (<class 'celery.schedules.schedule'>, <class 'timApp.celery_sqlalchemy_scheduler.models.IntervalSchedule'>, 'interval'), (<class 'celery.schedules.solar'>, <class 'timApp.celery_sqlalchemy_scheduler.models.SolarSchedule'>, 'solar'))#
next()#

Return new instance, with date and count fields updated.

save(fields=())[source]#
Params fields

tuple, the additional fields to save

save_fields = ['last_run_at', 'total_run_count', 'no_changes']#
classmethod to_model_schedule(session, schedule)[source]#

timApp.celery_sqlalchemy_scheduler.session module#

SQLAlchemy session.

class timApp.celery_sqlalchemy_scheduler.session.SessionManager[source]#

Bases: object

Manage SQLAlchemy sessions.

create_session(dburi, short_lived_sessions=False, **kwargs)[source]#
get_engine(dburi, **kwargs)[source]#
prepare_models(engine)[source]#
session_factory(dburi, **kwargs)[source]#
timApp.celery_sqlalchemy_scheduler.session.session_cleanup(session)[source]#

timApp.celery_sqlalchemy_scheduler.tzcrontab module#

Timezone aware Cron schedule Implementation.

class timApp.celery_sqlalchemy_scheduler.tzcrontab.TzAwareCrontab(minute='*', hour='*', day_of_week='*', day_of_month='*', month_of_year='*', tz=<UTC>, app=None)[source]#

Bases: celery.schedules.crontab

Timezone Aware Crontab.

is_due(last_run_at)[source]#

Calculate when the next run will take place.

Return tuple of (is_due, next_time_to_check). The last_run_at argument needs to be timezone aware.

nowfunc()[source]#
class timApp.celery_sqlalchemy_scheduler.tzcrontab.schedstate(is_due, next)#

Bases: tuple

is_due#

Alias for field number 0

next#

Alias for field number 1

Module contents#