scheduler package#

Submodules#

scheduler.constants module#

Class containg constants used across the scheduler package

@author adrian

class scheduler.constants.Constants#

Bases: object

DICTIONARY_END = '}'#
DICTIONARY_START = '{'#

scheduler.decoder module#

class scheduler.decoder.SchedulerDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)#

Bases: json.decoder.JSONDecoder

classmethod build() None#
classmethod decode(todecode) None#

decodes an object coming in a dictionary shape and convert it to a Scheduler

Parameters

todecode – the scheduler retrieved from the config file, in a form of dictionary

Returns

a Scheduler object containing the fields populated with the values from the config file

static handle_error() Exception#

scheduler.scheduler module#

class scheduler.scheduler.Scheduler(name, interval, units, every, at)#

Bases: object

build_job() str#

Builds a Job object in form of a string, based on the parameters set in the configuration file of the scheduler :return: the string representation of a Job object

classmethod build_params(**kwargs) str#

From the parameters of the scheduled function received, builds a dictionary in form of a string, that will be later evaluated when the scheduler will effectively queue :param kwargs: the parameters of the scheduled function :return: a dictionary with the same parameters in form of a string

cancel() None#

Cancels a running job. The current implementation of the scheduler is based on the fact that there is only one job per instance. Cancelling a job means removing it from the jobs list :return:

queue(*args, **kwargs) None#

Effectively runs the scheduler

Parameters
  • args – the callable object that is queue when the scheduler triggers

  • kwargs – the parameters passed to the function above in a key-value manner

Returns

None

scheduler.schedulers module#

class scheduler.schedulers.Schedulers#

Bases: object

classmethod add_scheduler(scheduler) None#

Adds a schedulers in the list of already existing schedulers :param scheduler: the scheduler to be added :return:

classmethod get_scheduler(name) scheduler.scheduler.Scheduler#

Gets a specific scheduler from the global list

Parameters

name – the name of the scheduler

Returns

the required scheduler

classmethod run()#
schedulers = None#

Module contents#