py_swf.clients.activity_task

class py_swf.clients.activity_task.ActivityTaskClient(activity_task_config, boto_client)[source]

A client that provides a pythonic API for polling and responding to activity tasks through an SWF boto3 client.

Parameters:
  • activity_task_config (ActivityTaskConfig) – Contains SWF values commonly used when making SWF api calls.
  • boto_client (Client) – A raw SWF boto3 client.
fail(task_token, reason, details=None)[source]

Responds to an activity task with a failure.

Passthrough to respond_activity_task_failed().

Parameters:
  • task_token (string) – The task_token returned from poll().
  • reason (string) – Description of the error that may assist in diagnostics
  • details (string) – Optional. Detailed information about the failure
Returns:

None

Return type:

NoneType

finish(task_token, result)[source]

Responds to an activity task with a success.

Passthrough to respond_activity_task_completed().

Parameters:
  • task_token (string) – The task_token returned from poll().
  • result (string) – The result of the executed activity task.
Returns:

None

Return type:

NoneType

poll(identity=None)[source]

Opens a connection to AWS and long-polls for activity tasks. When an activity is available, this function will return with exactly one activity task to execute.

Passthrough to poll_for_activity_task().

Parameters:identity (string) – A freeform text that identifies the client that performed the longpoll. Useful for debugging history.
Returns:An activity task to execute.
Return type:ActivityTask
Raises:py_swf.errors.NoTaskFound – Raised when polling for an activity times out without receiving any tasks.
class py_swf.clients.activity_task.ActivityTask(activity_id, type, version, input, task_token, workflow_id, workflow_run_id)

Contains the metadata to execute an activity task.

See the response syntax in poll_for_activity_task().

activity_id

Alias for field number 0

input

Alias for field number 3

task_token

Alias for field number 4

type

Alias for field number 1

version

Alias for field number 2

workflow_id

Alias for field number 5

workflow_run_id

Alias for field number 6