SlideShare a Scribd company logo
AWS
Simple WorkFlow

    by Nathan McCourtney
        May 2nd, 2012
          @beaknit
"Workflow"?

A workflow management system is a computer system that
manages and defines a series of tasks within an
organization to produce a final outcome or outcomes.

At each stage in the workflow, one individual or group is
responsible for a specific task. Once the task is complete,
the workflow software ensures that the individuals
responsible for the next task are notified and receive the
data they need to execute their stage of the process


http://en.wikipedia.org/wiki/Workflow
Amazon's 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 Workflow's coordination logic.
- From Jeff Barr's post
Workers & Deciders = Actors
From wikipedia:

In computer science, the Actor model is a mathematical
model of concurrent computation that treats "actors" as the
universal primitives of concurrent digital computation: in
response to a message that it receives, an actor can make
local decisions, create more actors, send more messages,
and determine how to respond to the next message
received.
Essentially, SWF is a framework for
 abstracting out actors and passing
messages between them via queues
Act!


                                       Work
                                       Queue



      Actor
                            Messages


1. Fetches its work
2. Drops off its results
                                       Result
                                       Queue
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
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
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
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
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
AWS example order-processing SWF




 Source: SWF Dev Guide
Practical Exercise


Nightly restore of a database to QA nodes combined with automated release
migration.
Examples
Aws dc simple-workflow
Further Reading


●   Official Announcement
●   Rightscale's blog on their use
●   Dev Guide - Basic Concepts
●   AWS Ruby SDK

More Related Content

PDF
DOM Performance (JSNext Bulgaria)
PPTX
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
PDF
Slick eventsourcing
PDF
Komunikacja oparta o zdarzenia z wykorzystaniem AWS Event Bridge
PPTX
Powershell_Basics_Robin
PDF
Node withoutservers aws-lambda
PDF
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
PDF
Thinking Functionally with Clojure
DOM Performance (JSNext Bulgaria)
Andrii Dembitskyi "Events in our applications Event bus and distributed systems"
Slick eventsourcing
Komunikacja oparta o zdarzenia z wykorzystaniem AWS Event Bridge
Powershell_Basics_Robin
Node withoutservers aws-lambda
Serverless Framework Workshop - Tyler Hendrickson, Chicago/burbs
Thinking Functionally with Clojure

What's hot (18)

PDF
Infrastructure-as-code: bridging the gap between Devs and Ops
PDF
AWS IoT 핸즈온 워크샵 - 실습 4. Device Failure 상황 처리하기 (김무현 솔루션즈 아키텍트)
PDF
Designing a Scalable Data Platform
PDF
React Internals
PDF
Altitude SF 2017: Nomad and next-gen application architectures
PDF
How Yelp uses Mesos to Power its SOA Infrastructure
PDF
Elements for an iOS Backend
PDF
NetflixOSS season 2 episode 2 - Reactive / Async
PDF
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Be...
PDF
React Lifecycle and Reconciliation
PDF
Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...
PDF
Mistral OpenStack Meetup Feb 5
PDF
10 minutes fun with Cloud API comparison
PDF
Designing a reactive data platform: Challenges, patterns, and anti-patterns
PPTX
Dropwizard Internals
PDF
Event Sourcing - what could possibly go wrong?
PPTX
Altitude SF 2017: Security at the edge
PDF
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Infrastructure-as-code: bridging the gap between Devs and Ops
AWS IoT 핸즈온 워크샵 - 실습 4. Device Failure 상황 처리하기 (김무현 솔루션즈 아키텍트)
Designing a Scalable Data Platform
React Internals
Altitude SF 2017: Nomad and next-gen application architectures
How Yelp uses Mesos to Power its SOA Infrastructure
Elements for an iOS Backend
NetflixOSS season 2 episode 2 - Reactive / Async
S3, Cassandra or Outer Space? Dumping Time Series Data using Spark - Demi Be...
React Lifecycle and Reconciliation
Cracking JWT tokens: a tale of magic, Node.js and parallel computing - Code E...
Mistral OpenStack Meetup Feb 5
10 minutes fun with Cloud API comparison
Designing a reactive data platform: Challenges, patterns, and anti-patterns
Dropwizard Internals
Event Sourcing - what could possibly go wrong?
Altitude SF 2017: Security at the edge
Andrzej Ludwikowski - Event Sourcing - what could possibly go wrong? - Codemo...
Ad

Viewers also liked (14)

PDF
Shenzhen longreen products brochure
PPTX
LumaNext ppt.11.16.15
PDF
OCP-SPIRIT-Final-v5
PPTX
Proactively Managing Your Data Center Infrastructure
PDF
Leading the Way in Intelligent Data Center Infrastructure
PDF
Architecting data center networks in the era of big data and cloud
PPTX
Managing human resources at data centers 1.0
PDF
Huawei presentation at TADHack
PDF
Fabric Arch Compet
PPTX
Data Center Trends 2014
PDF
Data Center Network Topologies
PDF
Arista Networks - Building the Next Generation Workplace and Data Center Usin...
PPT
Tia 942 Data Center Standards
PDF
Data center Building & General Specification
Shenzhen longreen products brochure
LumaNext ppt.11.16.15
OCP-SPIRIT-Final-v5
Proactively Managing Your Data Center Infrastructure
Leading the Way in Intelligent Data Center Infrastructure
Architecting data center networks in the era of big data and cloud
Managing human resources at data centers 1.0
Huawei presentation at TADHack
Fabric Arch Compet
Data Center Trends 2014
Data Center Network Topologies
Arista Networks - Building the Next Generation Workplace and Data Center Usin...
Tia 942 Data Center Standards
Data center Building & General Specification
Ad

Similar to Aws dc simple-workflow (20)

PDF
Basic Understanding and Implement of Node.js
PPTX
Ondemand scaling-aws
PDF
Nyc big datagenomics-pizarroa-sept2017
PPT
iOS Multithreading
PDF
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
PDF
JavaScript for real men
PDF
Dragoncraft Architectural Overview
PDF
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
PPT
PPTX
Evolution of netflix conductor
PPTX
e-suap - client technologies- english version
PPTX
Akka Microservices Architecture And Design
PPTX
[NDC 2019] Enterprise-Grade Serverless
PPTX
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
PDF
Building Continuous Application with Structured Streaming and Real-Time Data ...
PPTX
Apache Beam: A unified model for batch and stream processing data
PDF
FireWorks workflow software
PPTX
Integrate Solr with real-time stream processing applications
PDF
Expanding your impact with programmability in the data center
PDF
Do you know what your drupal is doing? Observe it!
Basic Understanding and Implement of Node.js
Ondemand scaling-aws
Nyc big datagenomics-pizarroa-sept2017
iOS Multithreading
LinuxCon 2013 Steven Dake on Using Heat for autoscaling OpenShift on Openstack
JavaScript for real men
Dragoncraft Architectural Overview
Apache Druid Auto Scale-out/in for Streaming Data Ingestion on Kubernetes
Evolution of netflix conductor
e-suap - client technologies- english version
Akka Microservices Architecture And Design
[NDC 2019] Enterprise-Grade Serverless
[NDC 2019] Functions 2.0: Enterprise-Grade Serverless
Building Continuous Application with Structured Streaming and Real-Time Data ...
Apache Beam: A unified model for batch and stream processing data
FireWorks workflow software
Integrate Solr with real-time stream processing applications
Expanding your impact with programmability in the data center
Do you know what your drupal is doing? Observe it!

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Modernizing your data center with Dell and AMD
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Empathic Computing: Creating Shared Understanding
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Machine learning based COVID-19 study performance prediction
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Understanding_Digital_Forensics_Presentation.pptx
cuic standard and advanced reporting.pdf
Modernizing your data center with Dell and AMD
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Empathic Computing: Creating Shared Understanding
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Encapsulation_ Review paper, used for researhc scholars
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Unlocking AI with Model Context Protocol (MCP)
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Dropbox Q2 2025 Financial Results & Investor Presentation
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Machine learning based COVID-19 study performance prediction

Aws dc simple-workflow

  • 1. AWS Simple WorkFlow by Nathan McCourtney May 2nd, 2012 @beaknit
  • 2. "Workflow"? A workflow management system is a computer system that manages and defines a series of tasks within an organization to produce a final outcome or outcomes. At each stage in the workflow, one individual or group is responsible for a specific task. Once the task is complete, the workflow software ensures that the individuals responsible for the next task are notified and receive the data they need to execute their stage of the process http://en.wikipedia.org/wiki/Workflow
  • 3. Amazon's 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 Workflow's coordination logic. - From Jeff Barr's post
  • 4. Workers & Deciders = Actors From wikipedia: In computer science, the Actor model is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received.
  • 5. Essentially, SWF is a framework for abstracting out actors and passing messages between them via queues
  • 6. Act! Work Queue Actor Messages 1. Fetches its work 2. 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 Exercise Nightly restore of a database to QA nodes combined with automated release migration.
  • 16. Further Reading ● Official Announcement ● Rightscale's blog on their use ● Dev Guide - Basic Concepts ● AWS Ruby SDK