Austin Open Stack Summit April 2016 Orchestrating Tasks

  • Slides: 34
Download presentation
Austin Open. Stack Summit April 2016 Orchestrating Tasks with Mistral Workflow Service Renat Akhmerov

Austin Open. Stack Summit April 2016 Orchestrating Tasks with Mistral Workflow Service Renat Akhmerov @Nokia

What we will cover • General info about Mistral • Workflows and why they

What we will cover • General info about Mistral • Workflows and why they are needed • Mistral in a nutshell • Mistral workflow language & features • Briefly on Mistral status and plans • Q&A 2

General Info on Mistral • Started in Nov, 2013 • Summits behind: Hong Kong,

General Info on Mistral • Started in Nov, 2013 • Summits behind: Hong Kong, Atlanta, Paris, Vancouver, Tokyo • Part of The Big Tent since May, 2015 • Stable community • Significant interest growth in Open. Stack community • Latest stable version: 2. 0. 0 (Mitaka) 3

Workflows 4

Workflows 4

What is Workflow? 5

What is Workflow? 5

Definition #1 Wikipedia: “… A workflow manages and monitors the state of activities, such

Definition #1 Wikipedia: “… A workflow manages and monitors the state of activities, such as the processing and approval of a loan application form, and determines which new activity to transition to according to defined processes (workflows). ” 6

Definition #2 Wikipedia: “A workflow engine is a software application that defines a process,

Definition #2 Wikipedia: “A workflow engine is a software application that defines a process, the rules governing process decisions, and routes information. ” 7

Definition #3 Wikipedia: “A workflow management system (Wf. MS) is a software system for

Definition #3 Wikipedia: “A workflow management system (Wf. MS) is a software system for the set-up, performance and monitoring of a defined sequence of tasks, arranged as a workflow. ” 8

Complicated? 9

Complicated? 9

Example: Getting to Open. Stack Summit Workflow is: • Graph • Tasks • Connections

Example: Getting to Open. Stack Summit Workflow is: • Graph • Tasks • Connections • State • Result • Data • Tasks may be long • Asynchrony Register (get a badge) Fly to Summit Pass Number Buy Summit Pass Arrange trip (flights, hotel) Discount Code Become an ATC Done! Contribute to Open. Stack Or Air tickets etc. Extra budget with you boss 10

How are these concepts related to computer systems? 11

How are these concepts related to computer systems? 11

Example: Parallel Computing Orchestration Can be done by Heat Create VM 1 Create VM

Example: Parallel Computing Orchestration Can be done by Heat Create VM 1 Create VM 2 Configure VM 1 Compute Configure VM 2 Compute Build a report Notify on completion Create VM 50 Configure VM 50 Compute 12

What is Mistral? Mistral is an Open. Stack Service that manages workflows 13

What is Mistral? Mistral is an Open. Stack Service that manages workflows 13

Main properties of a workflow system • Language to describe workflows • Tasks are

Main properties of a workflow system • Language to describe workflows • Tasks are distributed across enterprise/cloud environment • Support parallelism for running tasks • Synchronization of parallel branches • Data flows from one task to another • APIs to create/update/delete workflows • APIs and active component to execute workflows • APIs to monitor state of running workflows and tasks • Persistent state of running workflows and tasks 14

Persistent state is a key! • Progress • Observability • Execution history • Persistent

Persistent state is a key! • Progress • Observability • Execution history • Persistent result • Asynchrony • Effective error handling • Recovery • Critically important at large scale! Task 4 Task 5 Task 6 Task 3 Task 2 Error!! ! Task 1 Task 7 15

Right tool for the right task! Scripts: • Error handling is challenging • All

Right tool for the right task! Scripts: • Error handling is challenging • All is OK while a script is working • On an error we’re left with a mess • Not scalable • Lack of monitoring • No parallelism & synchronization • Not suitable for large scale orchestration! 16

Mistral language & features 17

Mistral language & features 17

Mistral Workflow language • YAML-based • Relies on YAQL expression language • Main features

Mistral Workflow language • YAML-based • Relies on YAQL expression language • Main features • Defining workflow tasks • Conditional task transitions • Publishing persistent variables • Fork & Join • Loops (to process data collections) • Engine commands (fail, succeed, pause, noop) • Task policies (retry, timeout, wait-before, wait-after, pause-before) • Nested workflows 18

Example: Deleting VMs by criteria version: '2. 0' tenant_cleanup: description: Deletes virtual machines containing

Example: Deleting VMs by criteria version: '2. 0' tenant_cleanup: description: Deletes virtual machines containing “mistral” in their names. tasks: get_vms: action: nova. servers_list publish: vms: <% $. get_vms['mistral' in $. name]. select(dict(id=>$. id, name=>$. name)) %> on-success: - delete_vms on-error: - fail delete_vms: with-items: vm in <% $. vms %> action: nova. servers_delete server=<% $. vm. id %> 19

Pluggable task actions • Defines what exactly a task should do • Written in

Pluggable task actions • Defines what exactly a task should do • Written in Python • Synchronous and asynchronous • > 500 actions out of the box • Standard actions: std. http, std. ssh, std. email, std. javascript etc. • Actions for Open. Stack services (Nova, Heat etc. ) • User can plug in new actions 20

Conditional transitions report_vms: input: - email_info send_report: action: std. email … send_error: action: std.

Conditional transitions report_vms: input: - email_info send_report: action: std. email … send_error: action: std. email … s ex ist get VMs if VM tasks: get_vms: action: nova. servers_list on-success: - send_report: <% $. get_vms. len() > 0 %> on-error: - send_error send report send error 21

Publishing persistent variables version: '2. 0' tenant_cleanup: tasks: get_vms: action: nova. servers_list publish: vms:

Publishing persistent variables version: '2. 0' tenant_cleanup: tasks: get_vms: action: nova. servers_list publish: vms: <% $. get_vms['mistral' in $. name]. select(dict(id=>$. id, name=>$. name)) %> on-success: - delete_vms: with-items: vm in <% $. vms %> action: nova. servers_delete server=<% $. vm. id %> 22

Fok & Join version: '2. 0' deploy_app: tasks: install_db: action: install_mysql on-success: - install_app

Fok & Join version: '2. 0' deploy_app: tasks: install_db: action: install_mysql on-success: - install_app install_web_server: action: install_web_server on-success: - install_app: join: all action: install_my_app branch 1 branch 2 install web server install DB join point install app merge of branch 1 & 2 23

Loops version: '2. 0' tenant_cleanup: description: Deletes virtual machines containing “mistral” in their names.

Loops version: '2. 0' tenant_cleanup: description: Deletes virtual machines containing “mistral” in their names. tasks: get_vms: action: nova. servers_list publish: vms: <% $. get_vms['mistral' in $. name]. select(dict(id=>$. id, name=>$. name)) %> on-success: - delete_vms on-error: - fail delete_vms: with-items: vm in <% $. vms %> action: nova. servers_delete server=<% $. vm. id %> 24

Engine commands version: '2. 0' deploy_app: tasks: get_vms: action: nova. servers_list on-success: - fail:

Engine commands version: '2. 0' deploy_app: tasks: get_vms: action: nova. servers_list on-success: - fail: <% $. get_vms. len() = 0 %> - install_app: … • fail - ends entire workflow with a failure • succeed - ends entire workflow with success • pause - puts entire workflow on hold (can be resumed manually) 25

Task policies cinder_backup: tasks: start_backup: action: cinder. backups_create … publish: backup_id: <% $. start_backup.

Task policies cinder_backup: tasks: start_backup: action: cinder. backups_create … publish: backup_id: <% $. start_backup. id %> on-success: - wait_for_backup: action: fail_if_not_ready id=<% $. backup_id %> wait-before: 30 retry: count=3 delay=5 on-success: - report_backup_is_ready: … • retry - repeats a task on failure • wait-before - waits a number of seconds before starting a task • wait-after - waits a number of seconds after task completion • pause-before - puts entire workflow on hold before running a task • timeout - fails a task is running longer than configured value 26

Nested workflows version: '2. 0' deploy_app: input: - vm_ids tasks: install_db: workflow: install_db vm_id=<%

Nested workflows version: '2. 0' deploy_app: input: - vm_ids tasks: install_db: workflow: install_db vm_id=<% $. vm_ids[0] %> on-success: - install_app: with-items: id in <% $. vm_ids %> action: std. ssh host=<% $. id %> input: cmd: ‘sudo apt-get install my_app’ 27

Cron trigger • Cloud alternative to crontab • HA • Runs workflow by configured

Cron trigger • Cloud alternative to crontab • HA • Runs workflow by configured cron pattern • Can limit number of executions e m na w o Example using CLI: l f k r o w $ mistral cron-trigger-create trig tenant_cleanup --pattern ‘*/5 * *’ 28

Back to Parallel Computing Orchestration example Create VM 1 Configur e VM 1 Compute

Back to Parallel Computing Orchestration example Create VM 1 Configur e VM 1 Compute Create VM 2 Configur e VM 2 Compute Join Build report Fork Send an email Configu re VM 50 Configur e VM 50 Compute 29

More use cases • Scheduled administrative tasks • Integration and orchestration of systems/services •

More use cases • Scheduled administrative tasks • Integration and orchestration of systems/services • Healing • Auto-scaling • Orchestration of application components • Cross-cloud coordination • Data center automation • Deployment • Long-running business processes • Big. Data analysis & reporting 30

Mistral current status • Workflow language completeness • Mistral works in HA • Seamless

Mistral current status • Workflow language completeness • Mistral works in HA • Seamless integration with Open. Stack APIs • Command Line Interface • Simple UI • A number of production installations 31

Mistral plans for Newton • Multi-region support • Usability improvements • Working with sensitive

Mistral plans for Newton • Multi-region support • Usability improvements • Working with sensitive data • Performance tuning • Better HA • Workflow visualization • ~ 100 other blueprints on Launchpad 32

Thank you! 33

Thank you! 33

Q&A Official documentation: http: //docs. openstack. org/developer/mistral/ Launchpad: https: //launchpad. net/mistral Wiki: https: //wiki.

Q&A Official documentation: http: //docs. openstack. org/developer/mistral/ Launchpad: https: //launchpad. net/mistral Wiki: https: //wiki. openstack. org/wiki/Mistral 34