2014-10-05 12:56:37 -07:00
Quick Start
2015-08-04 15:06:47 +03:00
===========
2015-08-27 15:31:51 +03:00
Install and Run Mistral
-----------------------
* Go through the installation manual: :doc: `Mistral Installation Guide </guides/installation_guide>`
Install Mistral Client
----------------------
* For installing mistralclient, please refer to :doc: `Mistral Client / CLI Guide </guides/mistralclient_guide>`
Export Keystone Credentials
---------------------------
To use the OpenStack command line tools you should specify environment variables with the configuration details for your OpenStack installation. The following example assumes that the Identity service is at `` 127.0.0.1:5000 `` , with a user `` admin `` in the `` admin `` tenant whose password is `` password `` ::
$ export OS_AUTH_URL=http://127.0.0.1:5000/v2.0/
$ export OS_TENANT_NAME=admin
$ export OS_USERNAME=admin
$ export OS_PASSWORD=password
Write Workflow
--------------
2015-10-13 13:27:47 +06:00
For example, we have the following workflow::
2015-08-27 15:31:51 +03:00
---
version: "2.0"
my_workflow:
type: direct
input:
- names
tasks:
task1:
with-items: name in <% $.names %>
action: std.echo output=<% $.name %>
on-success: task2
task2:
2016-02-01 23:04:25 +13:00
action: std.echo output="Done"
2015-08-27 15:31:51 +03:00
2016-07-15 18:43:33 +01:00
This simple workflow iterates through the given list of names in its first task (using "with-items"), stores
them as a task result (using echo action) and then stores the word "Done" as a result of the second task.
2015-10-13 13:27:47 +06:00
2015-08-27 15:31:51 +03:00
Create Workflow Object
----------------------
2015-10-13 13:27:47 +06:00
Use *Mistral CLI* to create the workflow::
2015-08-27 15:31:51 +03:00
mistral workflow-create <workflow.yaml>
Make sure that output is like the following::
+-------------+--------+---------+---------------------+------------+
| Name | Tags | Input | Created at | Updated at |
+-------------+--------+---------+---------------------+------------+
| my_workflow | <none> | names | 2015-08-13 08:44:49 | None |
+-------------+--------+---------+---------------------+------------+
Run Workflow and Check the Result
---------------------------------
2016-07-15 18:43:33 +01:00
Use *Mistral CLI* to run the newly-created workflow. Pass the variable **names** as **workflow_input** ::
2015-08-27 15:31:51 +03:00
mistral execution-create my_workflow '{"names": ["John", "Mistral", "Ivan", "Crystal"]}'
2016-07-15 18:43:33 +01:00
Make sure the output is like the following::
2015-08-27 15:31:51 +03:00
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| ID | 056c2ed1-695f-4ccd-92af-e31bc6153784 |
| Workflow | my_workflow |
| Description | |
| State | RUNNING |
| State info | None |
| Created at | 2015-08-28 09:05:00.065917 |
| Updated at | 2015-08-28 09:05:00.844990 |
+-------------+--------------------------------------+
2016-07-15 18:43:33 +01:00
After a while, check the status of the workflow execution (replace the example execution id with the real one)::
2015-08-27 15:31:51 +03:00
mistral execution-get 056c2ed1-695f-4ccd-92af-e31bc6153784
+-------------+--------------------------------------+
| Field | Value |
+-------------+--------------------------------------+
| ID | 056c2ed1-695f-4ccd-92af-e31bc6153784 |
| Workflow | my_workflow |
| Description | |
| State | SUCCESS |
| State info | None |
| Created at | 2015-08-28 09:05:00 |
| Updated at | 2015-08-28 09:05:03 |
+-------------+--------------------------------------+
2016-07-15 18:43:33 +01:00
The status of each **task** also can be checked::
2015-08-27 15:31:51 +03:00
mistral task-list 056c2ed1-695f-4ccd-92af-e31bc6153784
+--------------------------------------+-------+---------------+--------------------------------------+---------+
| ID | Name | Workflow name | Execution ID | State |
+--------------------------------------+-------+---------------+--------------------------------------+---------+
| 91874635-dcd4-4718-a864-ac90408c1085 | task1 | my_workflow | 056c2ed1-695f-4ccd-92af-e31bc6153784 | SUCCESS |
| 3bf82863-28cb-4148-bfb8-1a6c3c115022 | task2 | my_workflow | 056c2ed1-695f-4ccd-92af-e31bc6153784 | SUCCESS |
+--------------------------------------+-------+---------------+--------------------------------------+---------+
2016-07-15 18:43:33 +01:00
Check the result of task *'task1'* ::
2015-08-27 15:31:51 +03:00
mistral task-get-result 91874635-dcd4-4718-a864-ac90408c1085
[
"John",
"Mistral",
"Ivan",
"Crystal"
]
2016-07-15 18:43:33 +01:00
If needed, we can go deeper and look at a list of the results of the **action_executions** of a single task::
2015-08-27 15:31:51 +03:00
mistral action-execution-list 91874635-dcd4-4718-a864-ac90408c1085
+--------------------------------------+----------+---------------+-----------+---------+------------+-------------+
| ID | Name | Workflow name | Task name | State | State info | Is accepted |
+--------------------------------------+----------+---------------+-----------+---------+------------+-------------+
2016-07-15 18:43:33 +01:00
| 20c2b65d-b899-437f-8e1b-50fe477fbf4b | std.echo | my_workflow | task1 | SUCCESS | None | True |
| 6773c887-6eff-46e6-bed9-d6b67d77813b | std.echo | my_workflow | task1 | SUCCESS | None | True |
| 753a9e39-d93e-4751-a3c1-569d1b4eac64 | std.echo | my_workflow | task1 | SUCCESS | None | True |
| 9872ddbc-61c5-4511-aa7e-dc4016607822 | std.echo | my_workflow | task1 | SUCCESS | None | True |
2015-08-27 15:31:51 +03:00
+--------------------------------------+----------+---------------+-----------+---------+------------+-------------+
2016-07-15 18:43:33 +01:00
Check the result of the first **action_execution** ::
2015-08-27 15:31:51 +03:00
mistral action-execution-get-output 20c2b65d-b899-437f-8e1b-50fe477fbf4b
{
"result": "John"
}
**Congratulations! Now you are ready to use OpenStack Workflow Service!**