Package Dropbox :: Package web2py :: Package gluon :: Module scheduler :: Class Scheduler
[hide private]
[frames] | no frames]

Class Scheduler

source code

        object --+            
                 |            
threading._Verbose --+        
                     |        
      threading.Thread --+    
                         |    
             MetaScheduler --+
                             |
                            Scheduler

Instance Methods [hide private]
 
__init__(self, db, tasks=None, migrate=True, worker_name=None, group_names=['main'], heartbeat=3, max_empty_runs=0, discard_results=False, utc_time=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
now(self) source code
 
set_requirements(self, scheduler_task) source code
 
define_tables(self, db, migrate) source code
 
loop(self, worker_name=None) source code
 
wrapped_assign_tasks(self, db) source code
 
wrapped_pop_task(self) source code
 
pop_task(self, db) source code
 
report_task(self, task, task_report) source code
 
adj_hibernation(self) source code
 
send_heartbeat(self, counter) source code
 
being_a_ticker(self) source code
 
assign_tasks(self, db) source code
 
sleep(self) source code
 
queue_task(self, function, pargs=[], pvars={}, **kwargs)
Queue tasks.
source code
 
task_status(self, ref, output=False)
Shortcut for task status retrieval
source code

Inherited from MetaScheduler: async, die, give_up, run, start_heartbeats, terminate_process

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from threading.Thread (private): _set_daemon, _set_ident

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details [hide private]

__init__(self, db, tasks=None, migrate=True, worker_name=None, group_names=['main'], heartbeat=3, max_empty_runs=0, discard_results=False, utc_time=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

loop(self, worker_name=None)

source code 
Overrides: MetaScheduler.loop

pop_task(self, db)

source code 
Overrides: MetaScheduler.pop_task

report_task(self, task, task_report)

source code 
Overrides: MetaScheduler.report_task

send_heartbeat(self, counter)

source code 
Overrides: MetaScheduler.send_heartbeat

sleep(self)

source code 
Overrides: MetaScheduler.sleep

queue_task(self, function, pargs=[], pvars={}, **kwargs)

source code 

Queue tasks. This takes care of handling the validation of all
values.
:param function: the function (anything callable with a __name__)
:param pargs: "raw" args to be passed to the function. Automatically
    jsonified.
:param pvars: "raw" kwargs to be passed to the function. Automatically
    jsonified
:param kwargs: all the scheduler_task columns. args and vars here should be
    in json format already, they will override pargs and pvars

returns a dict just as a normal validate_and_insert, plus a uuid key holding
the uuid of the queued task. If validation is not passed, both id and uuid
will be None, and you'll get an "error" dict holding the errors found.

task_status(self, ref, output=False)

source code 

Shortcut for task status retrieval

:param ref: can be
    - integer --> lookup will be done by scheduler_task.id
    - string  --> lookup will be done by scheduler_task.uuid
    - query   --> lookup as you wish (as in db.scheduler_task.task_name == 'test1')
:param output: fetch also the scheduler_run record

Returns a single Row object, for the last queued task
If output == True, returns also the last scheduler_run record
    scheduler_run record is fetched by a left join, so it can
    have all fields == None