Aws dc simple-workflow
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Aws dc simple-workflow

on

  • 1,251 views

My preso on SimpleWorkFlow from the AWS-DC meetup

My preso on SimpleWorkFlow from the AWS-DC meetup

Statistics

Views

Total Views
1,251
Views on SlideShare
1,251
Embed Views
0

Actions

Likes
1
Downloads
13
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Aws dc simple-workflow Presentation Transcript

  • 1. AWSSimple WorkFlow by Nathan McCourtney May 2nd, 2012 @beaknit
  • 2. "Workflow"?A workflow management system is a computer system thatmanages and defines a series of tasks within anorganization to produce a final outcome or outcomes.At each stage in the workflow, one individual or group isresponsible for a specific task. Once the task is complete,the workflow software ensures that the individualsresponsible for the next task are notified and receive thedata they need to execute their stage of the processhttp://en.wikipedia.org/wiki/Workflow
  • 3. Amazons Workflow Model● A Workflow is the automation of a business process.● A Domain is a collection of related Workflows.● Actions are the individual tasks undertaken to carry out a Workflow.● Activity Workers are the pieces of code that actually implement the tasks. Each kind of Worker has its own Activity Type.● A Decider implements a Workflows coordination logic.- From Jeff Barrs post
  • 4. Workers & Deciders = ActorsFrom wikipedia:In computer science, the Actor model is a mathematicalmodel of concurrent computation that treats "actors" as theuniversal primitives of concurrent digital computation: inresponse to a message that it receives, an actor can makelocal decisions, create more actors, send more messages,and determine how to respond to the next messagereceived.
  • 5. Essentially, SWF is a framework for abstracting out actors and passingmessages between them via queues
  • 6. Act! Work Queue Actor Messages1. Fetches its work2. Drops off its results Result Queue
  • 7. AWS Message Passing ● HTTPS ● Long-poll interval of 60 seconds ● Message format is JSON: {"decisionType": "ScheduleActivityTask", "scheduleActivityTaskDecisionAttributes": {"activityType": {"name": "activityVerify", "version": "1.0"}, "activityId": "verification-27", "control": "digital music", "input": "5634-0056-4367-0923,12/12,437", "scheduleToCloseTimeout": "900", "taskList": {"name": "specialTaskList"}, "scheduleToStartTimeout": "300", "startToCloseTimeout": "600", "heartbeatTimeout": "120"} } ● One decision queue per Workflow ● Many activity queues per Workflow
  • 8. Decider to SWF Comms SWF Decider DTL ATL 1. Decider polls Decision Task List (DTL) for new decision tasks 2. Decision task returned with entire workflow execution history to provider context for decisions 3. Decider executes conditional logic and returns an activity task back to SimpleWorkFlow which then deposits in the Activity Task List (ATL)Note: Multiple deciders can process the same DTL
  • 9. From AWS Ruby SDK# poll for decision tasks from my-task-list domain.decision_tasks.poll( my-task-list ) do |task| # investigate new events and make decisions task.new_events.each do |event| case event.event_type when WorkflowExecutionStarted task.schedule_activity_task do-something , :input => abc xyz when ActivityTaskCompleted task.complete_workflow_execution :result => event.attributes.result end end end # decision task is completed here
  • 10. Worker to SWF Comms SWF Worker ATL DTL 1. Worker polls ATL for appropriate tasks - different workers can consume different tasks 2. Task completion returned to SWF which makes the result available to the Decider via the DTL Note: Multiple workers can process the same ATL
  • 11. From AWS Ruby SDK# poll my-task-list for activities domain.activity_tasks.poll( my-task-list ) do |activity_task| case activity_task.activity_type.name when do-something # ... else activity_task.fail! :reason => unknown activity task type end end
  • 12. AWS example order-processing SWF Source: SWF Dev Guide
  • 13. Practical ExerciseNightly restore of a database to QA nodes combined with automated releasemigration.
  • 14. Examples
  • 15. Further Reading● Official Announcement● Rightscales blog on their use● Dev Guide - Basic Concepts● AWS Ruby SDK