In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the example analysis of Mistral workflow components in Openstack, which is very detailed and has certain reference value. Friends who are interested must read it!
Mistrial is a workflow component developed by mirantis for openstack, which provides WorkFlow as a service. Typical user use cases include cloud platform task planning service (Cloud Cron), task scheduling (Task Scheduling), and complex long-running business process services. At present, the project is still in its infancy. It corresponds to the SWS (Simple WorkFlow Service) of AWS.
Project wiki: https://wiki.openstack.org/wiki/Mistral
Project Code: https://github.com/stackforge/mistral
1. Basic terminology
Workbook: workbook, the user's workflow interface, can be understood as a task document used to enter the user's workflow, steps, tasks to be completed. The order in which each task is executed, the dependencies, and the events that occur after each task is completed. From the user's point of view, this document fully records the flow of a task, so that the executor can know how to accomplish it. From the developer's point of view, for the convenience of programming. A new language DSL (described below) is defined to describe the entire workflow.
Task: the specific steps of the workflow. Can be a collection of Action.
Action: the smallest unit of Mistral. It refers to a specific job, such as sending a HTTP request or running a command.
Flow: workflow. It refers to how the task is executed in the Mistral system, parsing the task's dependencies, and so on, so that the task ends smoothly and returns the state.
WorkFlow Execution: workflow execution record. It refers to a specific Flow, the WorkFlow Execution generated by each execution of task will be permanently stored in the database to facilitate subsequent queries, or re-execute Flow.
2. DSL introduction
This is Mistral's custom workflow definition language. In the industry, there are already some languages of workflow management, please refer to:
Http://en.wikipedia.org/wiki/Business_Process_Execution_Language
Http://en.wikipedia.org/wiki/YAWL
Mistral uses YAML to define workflow wiki: https://wiki.openstack.org/wiki/Mistral/DSL
3. Actual combat
Download the latest code from Github and install the runtime environment. Start API and executor services at the same time
Tox-evenv-python mistral/cmd/launch.py-server executor-config-file etc/mistral.conftox-evenv-python mistral/cmd/launch.py-server api-config-file etc/mistral.conf
Then run the "scripts/upload_workbook_and_run.py" script, and you can clearly see the entire process.
[ray@fedora mistral] $python scripts/upload_workbook_and_run.py Created workbook: Workbook [description='My test workbook', name='my_workbook' Tags=' [uplift']'] Uploaded workbook: "Services: MyRest: type: REST_API parameters: baseUrl: http://localhost:8989/v1/ actions: my-action: parameters: url: workbooks method: GETWorkflow: tasks: my_task: action: MyRest:my-action# events:# my_event:# Type: periodic# tasks: my_task# parameters:# cron-pattern: "* *" execution: Execution [state='RUNNING' Task='my_task', id='b5cf7e00-ef5d-46d7-b505-2d23809d29d0rabbit, context='None', workbook_name='my_workbook'] execution: Execution [state='RUNNING', task='my_task', id='b5cf7e00-ef5d-46d7-b505-2d23809d29d0hammer, context='None', workbook_name='my_workbook'] execution: Execution [state='SUCCESS', task='my_task', id='b5cf7e00-ef5d-46d7-b505-2d23809d29d0bread, context='None', workbook_name='my_workbook']
We can install Misttral client (https://github.com/stackforge/python-mistralclient) to see what's going on. First of all, let's take a look at what workbook exists in the system, the my-wokbook that has just been run.
[ray@fedora mistral] $mistral workbook-listStarting new HTTP connection (1): localhost+-+ | Name | Description | Tags | +-+ | echo_workbook | My Test workbook | test | | my_workbook | My test workbook | test | +-+ [ray@fedora mistral] $mistral workbook-get-definition my_workbookStarting new HTTP connection (1): localhostServices: MyRest: type: REST_API parameters: baseUrl: http://localhost:8989/v1/ actions: My-action: parameters: url: workbooks method: GETWorkflow: tasks: my_task: action: MyRest:my-action# events:# my_event:# type: periodic# tasks: my_task# parameters:# cron-pattern: "* *"
This workbook first defines a service (registering a new service in the system, which generally contains a defined action, so that the user can specify to run the action in the task flow), the service type is REST, and then what are the parameters, and so on. Then a workflow is defined, in which the first task list (tasks) is my_task (taks name), and the task does one thing, which is to run the my_action action in the MyRest service.
Before looking at another workbook, simply define an ECHO type service. This service returns the ECHO value directly only for internal testing.
[ray@fedora mistral] $mistral workbook-get-definition echo_workbookStarting new HTTP connection (1): localhostServices: MyEcho: type: ECHO actions: EchoWords: parameters: word: optional: False Workflow: tasks: logPassTask: action: MyEcho:EchoWords parameters: word: " Log pass "MyEchoTask: action: MyEcho:EchoWords parameters: word:" hello World "on-success: logPassTask
To run log:
[ray@fedora mistral] $mistral execution-get echo_workbook bcf47b8c-6d44-4732-b32d-ebef92662f38Starting new HTTP connection (1): localhost+-+--+ | Field | Value | +-+- -- + | ID | bcf47b8c-6d44-4732-b32d-ebef92662f38 | | Workbook | echo_workbook | | Target | MyEchoTask | | State | SUCCESS | +-+- -- + [ray@fedora mistral] $mistral task-list echo_workbook bcf47b8c-6d44-4732-b32d-ebef92662f38Starting new HTTP connection (1): localhost+--+-+ -- + | ID | Workbook | Execution | Name | Description | State | Tags | +-- +-- +- +-+ | e5cb4a7a-b6c6-46ec-b62b-aa385bd3f8c2 | echo_workbook | bcf47b8c-6d44-4732-b32d-ebef92662f38 | MyEchoTask | | SUCCESS | | 1c99cc02-e1b0-44c2-b961-8589164bb851 | echo_workbook | bcf47b8c-6d44-4732-b32d-ebef92662f38 | logPassTask | | SUCCESS | | +- -+-- + 4. Recent progress
The above practical example may not make you aware of the relationship between mistral and openstack, and then believe that this workbook will make you understand.
Https://wiki.openstack.org/wiki/Mistral/DSL#Full_YAML_example:
For the workflow of VM, create a NOVA VM. The Mistral development team is implementing this type of workbook, the integration of openstack services. In this way, users do not need to use openstack CLI or API to operate, can directly write workbook (simply write documentation, not write code), let mistral help you complete the entire workflow.
Also about the integration of Mistral and taskflow:
In the process of implementation of Mistral, a lot of workflow code needs to be developed. This is somewhat similar to the purpose of TaskFlow in the openstack project library. To avoid duplication of effort, developers on both sides have discussed that in Mistral code, the back-end workflow code uses taskflow as the back-end as much as possible.
These are all the contents of the article "sample Analysis of Mistral Workflow components in Openstack". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.