selinon.selinon_task module

Base class for user-defined tasks.

class selinon.selinon_task.SelinonTask(flow_name, task_name, parent, task_id, dispatcher_id)[source]

Bases: object

Base class for user-defined tasks.

parent_flow_exception(flow_names, task_name, index=None)[source]

Retrieve parent task exception. You have to call this from a fallback (direct or transitive).

Parameters:
  • flow_names – name of parent flow or list of flow names in case of nested flows
  • task_name – name of task that failed (ancestor of calling task)
  • index – index of result if more than one subflow was run
Returns:

exception that was raised in the ancestor

parent_flow_result(flow_names, task_name, index=None)[source]

Retrieve result of parent sub-flow task.

Get parent subflow results; note that parent flows can return multiple results from task of same type because of loops in flows

Parameters:
  • flow_names – name of parent flow or list of flow names in case of nested flows
  • task_name – name of task in parent flow
  • index – index of result if more than one subflow was run
Returns:

result of task in parent subflow

parent_task_exception(parent_name)[source]

Retrieve parent task exception. You have to call this from a fallback (direct or transitive).

Parameters:parent_name – name of task that failed (ancestor of calling task)
Returns:exception that was raised in the ancestor
parent_task_result(parent_name)[source]

Retrieve parent task result.

Parameters:parent_name – name of parent task to retrieve result from
Returns:result of parent task
static retry(countdown=0)[source]

Retry, always raises Retry, this is compatible with Celery’s retry except you cannot modify arguments.

Parameters:countdown – countdown for rescheduling
run(node_args)[source]

Entrypoint - user defined computation.

Parameters:node_args – arguments passed to flow/node
Returns:tasks’s result that will be stored in database as configured
storage

Storage instance assigned to this task.

Returns:tasks’s configured storage as stated in YAML config