Task

class properties.extras.BaseTask[source]

Class for defining a computational task

Input and Output class attributes must be subclasses of BaseInput and BaseOutput respectively. Task is executed by calling an instance of the task with Input property/value pairs as keyword arguments.

__call__(**kwargs)[source]

Execute the task

Keyword arguments are used to construct Input instance. This is validated and passed to run. The Output of run is validated, passed to process_output, and returned.

process_output(output_obj)[source]

Processes valid Output object into desired task output

This method is executed during __call__ on the output of run.

By default, this serializes the output to a dictionary.

report_status(status)[source]

Hook for reporting the task status towards completion

run(input_obj)[source]

Execution logic for the task

This method must be overridden in Task subclasses

To run a Task, create an instance of the Task, then call the instance with the required input parameters. This will construct and validate an Input object.

run receives this validated Input object. It then must process the inputs and return an Output object.

class properties.extras.BaseInput(**kwargs)[source]

HasProperties object with input parameters for a computation

class properties.extras.BaseOutput(**kwargs)[source]

HasProperties object with the result of a computation

Required Properties:

  • log (String): Output log messages from the task, a unicode string
  • success (Boolean): Did the task succeed, a boolean, Default: True
class properties.extras.TaskStatus(**kwargs)[source]

HasProperties object to indicate present status of the task

Optional Properties:

  • message (String): Task progress message, a unicode string
  • progress (Float): Task progress to completion, a float in range [0, 1]
class properties.extras.TaskException[source]

An exception related to a computational task

class properties.extras.PermanentTaskFailure[source]

An exception indicating Task should not be retried

class properties.extras.TemporaryTaskFailure[source]

An exception indicating Task should be retried