- 1 What is Mistral?
- 2 Use cases
- 3 Rationale
- 4 Terminology & Workflow Model
- 5 Specifications
- 6 Cookbooks
- 7 Screencasts
- 8 Releases
- 9 Development (Blueprints, Roadmap, Design...)
- 10 Links & IRC
- 11 Team
- 12 FAQ
- 13 Subpages
What is Mistral?
Mistral is a workflow service. Most business processes consist of multiple distinct interconnected steps that need to be executed in a particular order in a distributed environment. One can describe such process as a set of tasks and task relations and upload such description to Mistral so that it takes care of state management, correct execution order, parallelism, synchronization and high availability. Mistral also provides flexible task scheduling so that we can run a process according to a specified schedule (i.e. every Sunday at 4.00pm) instead of running it immediately. We call such set of tasks and relations between them a workflow.
Tasks Scheduling - Cloud Cron
A user can use Mistral to schedule tasks to run within a cloud. Tasks can be anything from executing local processes (shell scripts, binaries) on specified virtual instances to calling REST APIs accessible in a cloud environment. They can also be tasks related to cloud management like creating virtual instances, terminating instances and others. It is important that several tasks can be combined in a single workflow and run in on-schedule manner (i.e. on Sundays at 2.00 am). Mistral will take care of their parallel execution, if it's logically possible, as well as fault tolerance and will provide workflow execution management/monitoring capabilities (stop, resume, current status, errors and other statistics).
Cloud Environment Deployment
A user or a framework can use Mistral to specify workflows needed for deploying environments consisting of multiple VMs and applications.
Long-running business process
A user makes a request to run a complex multi-step business process and wants it to be fault-tolerant so that if the execution crashes at some point on one node then another active node of the system can automatically take on and continue from the exact same point where it stopped. In this use case the user splits the business process into a set of tasks and let Mistral handle them in a sense that it serves as a coordinator and decides what particular task should be started at what time. So that Mistral calls back with "Execute action X, here is the data". If an application that executes action X dies then another instance takes the responsibility to continue the work.
BigData analysis & reporting
A data analyst can use Mistral as a tool for data crawling. For example, in order to prepare a financial report the whole set of steps for gathering and processing required report data can be represented as a graph of related Mistral tasks. As with other cases, Mistral makes sure to supply fault tolerance, high availability and scalability.
A user specifies tasks for VM live migration triggered upon an event from Ceilometer (CPU consumption 100%).
The main idea behind Mistral service includes the following main points:
- Ability to upload custom workflow definitions.
- The actual task execution may not be performed by the service itself. The service can rather serve a coordinator for other worker processes that do the actual work and notify back about task execution results. In other words, task execution may be asynchronous thus providing flexibility for plugging in any domain specific handling and opportunities to make this service scalable and highly available.
- The service provides a notion of task action which is a pluggable piece of logic that a workflow task is associated with. Out of the box the service provides a set of standard actions for user convenience. However, the user can create custom actions based on the standard action pack.
Terminology & Workflow Model
- Mistral 0.1, part 1: http://www.youtube.com/watch?v=9kaac_AfNow
- Mistral 0.1, part 2: http://www.youtube.com/watch?v=u6ki_DIpsg0
- Mistral POC: http://www.youtube.com/watch?v=x-zqz1CRVkI
Development (Blueprints, Roadmap, Design...)
- Proof of Concept (PoC)
- Automated Tests Details
- Mistral/Meetings Meetings
Links & IRC
- Project at Launchpad: http://launchpad.net/mistral
- Weekly IRC meeting is held on Mondays at 16:00 UTC on #openstack-meeting at Freenode.
- Weekly IRC meeting agenda: https://wiki.openstack.org/wiki/Meetings/MistralAgenda
- IRC channel for regular daily discussions: #openstack-mistral
Q: What is Mistral?
A: Mistral is a task management service. It is also known as Workflow as a Service. Most business processes consist of multiple distinct interconnected steps that need to be executed in a particular order. One can describe such process as a set of tasks and task relations and upload such description to Mistral so that it takes care of state management, correct execution order, task distribution and high availability. Mistral also provides flexible task scheduling so that we can run a process according to a specified schedule (i.e. every Sunday at 4.00pm) instead of running it immediately. We call such set of tasks and dependencies between them a workflow. Independent routes are called flows and Mistral can execute them in parallel.
Q: Why offload business processes to 3rd party service?
A: Reason 1: High Availability. A typical application’s workflow consists of many independent tasks like collecting data, processing, resource acquiring, obtaining user input, reporting, sending notifications, replicating data etc. All of the steps must happen in appropriate time as they depend on each other. Many such processes can run in parallel. Now if your application crashes somewhere in the middle or a power outage occurs your business process terminates at unknown stage in an unknown state. So you need to track a state of every single flow in some external persistent storage like database so that you can resume it (or roll it back) from the place it crashed. You also need some health monitoring tool that would watch your app and if it crashed schedule unfinished flows on another instance. This is exactly what Mistral can do out of the box without reinventing the wheel for each application time and time again.
Reason 2: Scalability. Most workflows have steps that can be performed in parallel (i.e. different routes in a workflow). Mistral can distribute execution of such tasks across your application’s instances so that the whole execution would scale.
Reason 3: Observable state. Because flow state is tracked outside of application it becomes observable. At any given moment system administrator can access information on what is currently going on, what tasks are in pending state and what has already been executed. You can obtain metrics on your business processes and profile them.
Reason 4: Scheduling. Using Mistral you can schedule your process to be run periodically or at a fixed moment in future. You can have your execution to be triggered on alarm condition from an external health monitoring system or upon a new email in your mailbox.
Reason 5: Dependency management offloading. Because you offload task management to an external service you don’t have to specify all the triggers and actions in advance. For example, you may say “here is the task that must be triggered if my domain is down for 1 minute” without specifying how exactly the event is obtained. System administrator can setup Nagios to watch your domain and trigger the action and replace it later with Ceilometer without your application being affected or even aware of the change. Administrator can even manually trigger the task using CLI or UI console. Or another example is having a task that triggers each time a flow reaches some desired state and let administrator configure what exactly needs to happen there (like send a notification mail and later replace it with SMS).
Reason 6: Open additional points for integration. As soon as your business process is converted to a Mistral workflow that can be accessed by others other application can setup their own workflow to be triggered by your application reaching a certain state. For example suppose OpenStack Nova would declare a workflow for new VM instance spawning. One application (or system administrator) can hook to a task “finish” so that every time Nova spawns another instance you would receive a notification. Or suppose you want your users to have flexible quotas on how many instances one can spawn based on information in external billing system. Normally you would have to patch Nova to access your billing system but with Mistral you can just alter Nova’s workflow so that it includes your custom tasks that would do it instead.
Reason 7: Formalized graphs of tasks are just easier to manage and understand. They can be visualized, analyzed and optimized. They simplify program development and debugging. You can model program workflows, replace task actions with stubs, easily mock external dependencies, do task profiling.
Q: How do I make Mistral know about my workflows?
A: workflows are described using the DSL. Currently YAML is considered the primary syntax for Mistral DSL, however, other alternatives like JSON or XML can also be supported. There is a REST API that is used to upload workflows, execute them and do run-time modifications against them. DSL describes
- Transitions between tasks (what should run next once a task completed). Applicable for "direct" workflow type.
- Dependencies between tasks (what tasks need to be run before this task can be executed). Applicable for "reverse" workflow type.
- Various policies applied to how tasks should run. For example, "retry" policies helps with running a task multiple times in case of failures.
- Ad-hoc actions that can be used for to transform input or output of other actions for convenience.
Q: What exactly are Mistral tasks?
A: Tasks are objects. Each such object has:
- Optional tag names.
- List of tasks it depends on for reverse workflows or list of transitions for direct workflows
- Optional YAQL expression that extracts data from current data context so that it would go as a task execution input.
- Optional task action (concrete work to do).
- Optional task workflow. If specified, such task is associated with another workflow execution (subworkflow).
Q: What are Mistral workflows?
A: A set of tasks and rules according to which these tasks run. Each workflow is designed to solve a certain domain problem like autoscaling a web application.
Q: What are Mistral workbooks?
A: Workbook is a convenience bag to carry multiple workflows and ad-hoc actions within a single file. It also has a namespacing function.
Q: What are Mistral actions and how does Mistral execute them?
A: Action is what to do when an exact task is triggered. Examples are: Run a shell script. Send an email. Call your app’s URI. Send an AMQP (RabbitMQ) message to some queue. Other types of signaling (email, UDP message, polling etc.).
Mistral can be extended to include other general purpose actions like Calling Puppet, Chef, Murano, SaltStack etc. etc.
Q: Is it possible to organize a data flow between different tasks in Mistral?
A: Yes, tasks belonging to the same workflow can take some input as a json structure, query a subset of this structure interesting for this particular task using YAQL expression (https://pypi.python.org/pypi/yaql) and pass it along to a corresponding action. Once the action has done its processing it returns the result back using similar json format. So in this case Mistral acts as a data flow hub dispatching results of one tasks to inputs of other tasks.
Q: Does Mistral provide a mechanism to run nested workflows?
A: Instead of performing a concrete action associated with a task Mistral can start a nested workflow. That is, given the input that came into the task Mistral starts a new workflow with that input and after completion execution jumps back to the parent workflow and continues from the same point. The closest analogy in programming would be calling one method from another passing all required parameters and optionally getting back a result. It’s worth noting that the nested workflow works in parallel with the rest of the activities belonging to the parent execution and it has its own isolated execution context observable via API.
Q: What are some other potential Mistral capabilities?
A: The team is also considering some other capabilities that may be implemented in Mistral or on top the base functionality in a form toolsets and frameworks:
- Priority-based workflow type where tasks' execution order is automatically calculated based on task priorities.
- Subscribing to Mistral events for arbitrary passive listeners.
- Role Based Access Control for managing and executing workflows.
- Ability to start dedicated worker VMs able to perform a set of predefined (or configured) actions like executing a specified script or any arbitrary code (in Python, Java etc.). That may be targeted to use cases when a user needs to do some sort of parallel execution on a temporarily created cluster. For example, we may want to process a set of objects residing in Swift using 100 temporary worker VMs so that we can logically split this set of objects into 100 segments and let the workers process them individually.
- Plugin system that would allow to introduce additional means into DSL and REST API via custom plugins (say we use a plugin for connecting to Mule ESB using namespace “mule:” in DSL).
Q: Who are Mistral users?
A: Potential Mistral users are: Developers. Both who work on OpenStack services and those running in tenant’s VMs. Developers use Mistral DSL/API to access it. System integrators. They customize workflows related with deployment using either special scripts or manually using Mistral CLI/UI. System administrators can use Mistral via additional toolset for common administrative tasks. This can be distributed cron, mass deployment tasks, backups etc.
Q: How does Mistral relate to OpenStack?
A: Although Mistral is quite generic it is built to become a natural part of OpenStack ecosystem. Out of the box Mistral provides "openstack" action pack for using functionality provided by other OpenStack services like Nova, Neutron or Heat. Mistral workflows can also be run from Murano PL.
Q: Is Mistral going to be an OpenStack infrastructure-layer service (as Nova) or be deployed on user VMs inside OpenStack?
A: Both use cases are valid and we are going to support both scenarios.
Q: Why not just use TaskFlow?
A: Mistral and TaskFlow have many similarities but target different use cases. TaskFlow is a Python library that you can use inside your Python app to manage Python workflows. Mistral is an out-of-process service that is language-agnostic and cannot execute some arbitrary Python code directly as TaskFlow does, it rather operates with "action" abstraction. As an external service it can have distributed task execution, scalability and HA.
Mistral team is planning to implement a workflow type though based on TaskFlow in the future.
Q: How does Mistral relate to Convection?
A: We believe that Mistral is a Convection implementation that goes far beyond the initial proposal to address additional use cases. We closely work with TaskFlow team who are also the people behind Convection. Convection as a project was never started and Mistral was designed to take its place although under different name for trademark reasons.
Q: Why not use Celery?
A: While Celery is distributed task engine it was designed to execute custom Python code on preinstalled private workers. Again this is a different use case with Mistral which assumes the tasks can be executed on a shared service and do not require (or allow) custom code upload. In other words, Celery itself could be implemented on top of Mistral if it started now.
Q: How does Mistral relate to Amazon SWF?
A: Amazon SWF shares many ideas with Mistral but, in fact, is designed to be language-oriented (Java, Ruby, Python). It is hard and mostly meaningless to use SWF without its, for example, Java SDK that exposes its functionality as a set of Java annotations and interfaces. In this sense SWF is closer to Celery than to Mistral. Mistral on the other hand wants to be both simpler and more user-friendly. We want to have a service that is usable without an SDK in any programming language. At the same time it’s always possible to implement additional convenient language-oriented bindings based on cool features like Python decorators, Java annotations and aspects.
At later stages Mistral may include SWF API adapter so that SWF applications may be migrated to Mistral.
- Mistral/Cloud Cron details
- Mistral/Cloud Environment Deployment details
- Mistral/Long Running Business Process
- Mistral/Meetings Meetings
- Mistral/terminology and model