Package s3 :: Module s3task :: Class S3Task
[frames] | no frames]

Class S3Task

source code

object --+
         |
        S3Task

Asynchronous Task Execution

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
configure_tasktable_crud(self, task=None, function=None, args=None, vars=None, period=3600)
Configure the task table for interactive CRUD, setting defaults, widgets and hiding unnecessary fields
source code
 
async(self, task, args=None, vars=None, timeout=300)
Wrapper to call an asynchronous task.
source code
 
schedule_task(self, task, args=None, vars=None, function_name=None, start_time=None, next_run_time=None, stop_time=None, repeats=None, period=None, timeout=None, enabled=None, group_name=None, ignore_duplicate=False, sync_output=0)
Schedule a task in web2py Scheduler
source code
 
authenticate(self, user_id)
Activate the authentication passed from the caller to this new request - run from within the task
source code

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

Static Methods
 
reset(task_id)
Reset the status of a task to QUEUED after FAILED
source code
Class Variables
  TASK_TABLENAME = "scheduler_task"
Properties

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

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

Overrides: object.__init__
(inherited documentation)

configure_tasktable_crud(self, task=None, function=None, args=None, vars=None, period=3600)

source code 

Configure the task table for interactive CRUD, setting defaults, widgets and hiding unnecessary fields

Parameters:
  • task - the task name (will use a UUID if omitted)
  • function - the function name (won't hide if omitted)
  • args - the function position arguments
  • vars - the function named arguments

async(self, task, args=None, vars=None, timeout=300)

source code 

Wrapper to call an asynchronous task.
- run from the main request

@param task: The function which should be run
             - async if a worker is alive
@param args: The list of unnamed args to send to the function
@param vars: The list of named vars to send to the function
@param timeout: The length of time available for the task to complete
                - default 300s (5 mins)

schedule_task(self, task, args=None, vars=None, function_name=None, start_time=None, next_run_time=None, stop_time=None, repeats=None, period=None, timeout=None, enabled=None, group_name=None, ignore_duplicate=False, sync_output=0)

source code 

Schedule a task in web2py Scheduler

Parameters:
  • task - name of the function/task to be scheduled
  • args - args to be passed to the scheduled task
  • vars - vars to be passed to the scheduled task
  • function_name - function name (if different from task name)
  • start_time - start_time for the scheduled task
  • next_run_time - next_run_time for the the scheduled task
  • stop_time - stop_time for the the scheduled task
  • repeats - number of times the task to be repeated (0=unlimited)
  • period - time period between two consecutive runs (seconds)
  • timeout - set timeout for a running task
  • enabled - enabled flag for the scheduled task
  • group_name - group_name for the scheduled task
  • ignore_duplicate - disable or enable duplicate checking
  • sync_output - sync output every n seconds (0 = disable sync)

reset(task_id)
Static Method

source code 

Reset the status of a task to QUEUED after FAILED

Parameters:
  • task_id - the task record ID

authenticate(self, user_id)

source code 

Activate the authentication passed from the caller to this new request
- run from within the task

NB This is so simple that we don't normally run via this API
   - this is just kept as an example of what needs to happen within the task


Class Variable Details

TASK_TABLENAME

Value:
"scheduler_task"