API Reference

flowser.domain

class flowser.domain.Domain(conn)[source]

Represents a Simple Workflow domain.

Subclasses must set a name property. They may also set a retention_period property (defaults to ‘30’).

To register types, workflow_types and activity_types need to be set. They should be lists of types.Workflow and types.Activity subclasses.

activities(t)[source]

High-level interface to iterate over activity tasks.

This method polls for new tasks of the given type indefinitely.

Parameters:t – Subclass of types.Type.
activity_types = None
decisions(t)[source]

High-level interface to iterate over decision tasks.

This method polls for new tasks of the given type indefinitely.

Parameters:t – Subclass of types.Type.
register(raise_exists=False)[source]

Register domain and associated types on AWS.

retention_period = '30'
start(t, input)[source]

Start execution.

Internally, this method creates an instance of t and calls its start method with the given input.

Parameters:t – Subclass of types.Type.
workflow_types = None

flowser.types

class flowser.types.Activity(domain)[source]

Base class for activity types.

Subclasses must set name, task_list and version properties and implement a schedule class method.

heartbeat_timeout = '3600'
classmethod schedule(input, control=None)[source]

Called from subclasses’ schedule class method.

schedule_to_close_timeout = '3600'
schedule_to_start_timeout = '3600'
start_to_close_timeout = '3600'
class flowser.types.Type(domain)[source]

Base class for Simple Workflow types (activities, workflows).

Subclasses must set name, version and task_list properties. They must also implement get_id_from_input.

static get_id_from_input(input)[source]

Get id from input.

This class method is used to get unique workflow and activity ids.

A typical implementation may retrieve and id field from the input and append it to the class’s task list.

Parameters:input – Input used when starting and scheduling workflows and tasks.
class flowser.types.Workflow(domain)[source]

Base class for workflow types.

Subclasses must set name and task_list properties and implement a start method and a start_child class method.

child_policy = 'TERMINATE'
default_filter_tag = None
default_tag_list = None
execution_start_to_close_timeout = '600'
classmethod start_child(input, control=None)[source]

Start child workflow execution.

input is serialized and a workflow id is generated from it using get_id_from_input.

task_start_to_close_timeout = '120'

flowser.tasks

class flowser.tasks.Activity(result, caller)[source]

Wrapper for “PollForActivityTask” results.

See http://docs.amazonwebservices.com/amazonswf/latest/apireference/API_PollForActivityTask.html.

cancel(details=None)[source]
complete(result=None)[source]
fail(details=None, reason=None)[source]
class flowser.tasks.ActivityType(result)[source]

Wrapper for the API data type.

See http://docs.amazonwebservices.com/amazonswf/latest/apireference/API_ActivityType.html.

class flowser.tasks.Decision(result, caller)[source]

Wrapper for “PollForDecisionTask” results.

See http://docs.amazonwebservices.com/amazonswf/latest/apireference/API_PollForDecisionTask.html.

This class assumes that history events are in reverse order (most recent first).

complete(context=None)[source]
events[source]
fail(details=None, reason=None)[source]
filter(event_type)[source]
mark(name, details=None)[source]

Adds a RecordMarker decision.

most_recent(event_type)[source]
schedule(activity_type, *args, **kwargs)[source]

Schedule activity.

Internally, this method calls the schedule classmethod on the activity type with the given args and kwargs.

Parameters:activity_type – Subclass of types.Activity.
start_child(workflow_type, *args, **kwargs)[source]

Start child workflow.

Internally, this method calls the start_child classmethod on the workflow type with the given args and kwargs.

Parameters:workflow_type – Subclass of types.Workflow.
start_input[source]

Get start input as a python object.

This method iterates over the event history to find the WorkflowExecutionStarted event and unserializes its input attribute. The result is cached.

class flowser.tasks.WorkflowExecution(result, caller)[source]

Wrapper for the API data type.

See http://docs.amazonwebservices.com/amazonswf/latest/apireference/API_WorkflowExecution.html.

abandon(details=None, reason=None)[source]
complete(result, context=None)[source]

Complete workflow execution.

This can only be called from a decision task.

request_cancel()[source]
signal(name, input=None)[source]
terminate(details=None, reason=None)[source]
terminate_request_cancel(details=None, reason=None)[source]
class flowser.tasks.WorkflowType(result)[source]

Wrapper for the API data type.

See http://docs.amazonwebservices.com/amazonswf/latest/apireference/API_WorkflowType.html.

flowser.exceptions

exception flowser.exceptions.EmptyTaskPollResult[source]
exception flowser.exceptions.Error[source]
exception flowser.exceptions.LastPage[source]

Table Of Contents

Related Topics

This Page