Merge "Add namespace parameter to Workbook API doc"

This commit is contained in:
Zuul 2018-08-01 06:45:16 +00:00 committed by Gerrit Code Review
commit 12081eb94a
3 changed files with 70 additions and 59 deletions

View File

@ -75,11 +75,11 @@ Use the *Mistral CLI* to create the workflow::
The output should look similar to this::
+------------------------------------+-------------+--------+---------+---------------------+------------+
|ID | Name | Tags | Input | Created at | Updated at |
+------------------------------------+-------------+--------+---------+---------------------+------------+
|9b719d62-2ced-47d3-b500-73261bb0b2ad| my_workflow | <none> | names | 2015-08-13 08:44:49 | None |
+------------------------------------+-------------+--------+---------+---------------------+------------+
+------------------------------------+-------------+-----------+--------+-------+---------------------+------------+
|ID | Name | Namespace | Tags | Input | Created at | Updated at |
+------------------------------------+-------------+-----------+--------+-------+---------------------+------------+
|9b719d62-2ced-47d3-b500-73261bb0b2ad| my_workflow | | <none> | names | 2015-08-13 08:44:49 | None |
+------------------------------------+-------------+-----------+--------+-------+---------------------+------------+
Run the workflow and check the result
@ -92,49 +92,53 @@ as JSON::
Make sure the output is like the following::
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| ID | 49213eb5-196c-421f-b436-775849b55040 |
| Workflow ID | 9b719d62-2ced-47d3-b500-73261bb0b2ad |
| Workflow name | my_workflow |
| Description | |
| Task Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2017-03-06 11:24:10 |
| Updated at | 2017-03-06 11:24:10 |
+-------------------+--------------------------------------+
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| ID | 49213eb5-196c-421f-b436-775849b55040 |
| Workflow ID | 9b719d62-2ced-47d3-b500-73261bb0b2ad |
| Workflow name | my_workflow |
| Workflow namespace | |
| Description | |
| Task Execution ID | <none> |
| Root Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2017-03-06 11:24:10 |
| Updated at | 2017-03-06 11:24:10 |
+--------------------+--------------------------------------+
After a moment, check the status of the workflow execution (replace the
example execution id with the ID output above)::
$ mistral execution-get 49213eb5-196c-421f-b436-775849b55040
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| ID | 49213eb5-196c-421f-b436-775849b55040 |
| Workflow ID | 9b719d62-2ced-47d3-b500-73261bb0b2ad |
| Workflow name | my_workflow |
| Description | |
| Task Execution ID | <none> |
| State | SUCCESS |
| State info | None |
| Created at | 2017-03-06 11:24:10 |
| Updated at | 2017-03-06 11:24:20 |
+-------------------+--------------------------------------+
+--------------------+--------------------------------------+
| Field | Value |
+--------------------+--------------------------------------+
| ID | 49213eb5-196c-421f-b436-775849b55040 |
| Workflow ID | 9b719d62-2ced-47d3-b500-73261bb0b2ad |
| Workflow name | my_workflow |
| Workflow namespace | |
| Description | |
| Task Execution ID | <none> |
| Root Execution ID | <none> |
| State | SUCCESS |
| State info | None |
| Created at | 2017-03-06 11:24:10 |
| Updated at | 2017-03-06 11:24:20 |
+--------------------+--------------------------------------+
The status of each **task** also can be checked::
$ mistral task-list 49213eb5-196c-421f-b436-775849b55040
+--------------------------------------+-------+---------------+--------------------------------------+---------+------------+---------------------+---------------------+
| ID | Name | Workflow name | Execution ID | State | State info | Created at | Updated at |
+--------------------------------------+-------+---------------+--------------------------------------+---------+------------+---------------------+---------------------+
| f639e7a9-9609-468e-aa08-7650e1472efe | task1 | my_workflow | 49213eb5-196c-421f-b436-775849b55040 | SUCCESS | None | 2017-03-06 11:24:11 | 2017-03-06 11:24:17 |
| d565c5a0-f46f-4ebe-8655-9eb6796307a3 | task2 | my_workflow | 49213eb5-196c-421f-b436-775849b55040 | SUCCESS | None | 2017-03-06 11:24:17 | 2017-03-06 11:24:18 |
+--------------------------------------+-------+---------------+--------------------------------------+---------+------------+---------------------+---------------------+
+--------------------------------------+-------+---------------+--------------------+--------------------------------------+---------+------------+---------------------+---------------------+
| ID | Name | Workflow name | Workflow namespace | Execution ID | State | State info | Created at | Updated at |
+--------------------------------------+-------+---------------+--------------------+--------------------------------------+---------+------------+---------------------+---------------------+
| f639e7a9-9609-468e-aa08-7650e1472efe | task1 | my_workflow | | 49213eb5-196c-421f-b436-775849b55040 | SUCCESS | None | 2017-03-06 11:24:11 | 2017-03-06 11:24:17 |
| d565c5a0-f46f-4ebe-8655-9eb6796307a3 | task2 | my_workflow | | 49213eb5-196c-421f-b436-775849b55040 | SUCCESS | None | 2017-03-06 11:24:17 | 2017-03-06 11:24:18 |
+--------------------------------------+-------+---------------+--------------------+--------------------------------------+---------+------------+---------------------+---------------------+
Check the result of task *'task1'*::
@ -152,14 +156,14 @@ If needed, we can go deeper and look at a list of the results of the
$ mistral action-execution-list f639e7a9-9609-468e-aa08-7650e1472efe
+--------------------------------------+----------+---------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
| ID | Name | Workflow name | Task name | Task ID | State | Accepted | Created at | Updated at |
+--------------------------------------+----------+---------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
| 4e0a60be-04df-42d7-aa59-5107e599d079 | std.echo | my_workflow | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| 5bd95da4-9b29-4a79-bcb1-298abd659bd6 | std.echo | my_workflow | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| 6ae6c19e-b51b-4910-9e0e-96c788093715 | std.echo | my_workflow | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| bed5a6a2-c1d8-460f-a2a5-b36f72f85e19 | std.echo | my_workflow | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:17 |
+--------------------------------------+----------+---------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
+--------------------------------------+----------+---------------+--------------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
| ID | Name | Workflow name | Workflow namespace | Task name | Task ID | State | Accepted | Created at | Updated at |
+--------------------------------------+----------+---------------+--------------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
| 4e0a60be-04df-42d7-aa59-5107e599d079 | std.echo | my_workflow | | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| 5bd95da4-9b29-4a79-bcb1-298abd659bd6 | std.echo | my_workflow | | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| 6ae6c19e-b51b-4910-9e0e-96c788093715 | std.echo | my_workflow | | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:16 |
| bed5a6a2-c1d8-460f-a2a5-b36f72f85e19 | std.echo | my_workflow | | task1 | f639e7a9-9609-468e-aa08-7650e1472efe | SUCCESS | True | 2017-03-06 11:24:12 | 2017-03-06 11:24:17 |
+--------------------------------------+----------+---------------+--------------------+-----------+--------------------------------------+---------+----------+---------------------+---------------------+
Check the result of the first **action_execution**::

View File

@ -47,12 +47,12 @@ class WorkbooksController(rest.RestController, hooks.HookController):
def get(self, name, namespace=''):
"""Return the named workbook.
:param name: Name of workbook to retrieve
:param namespace: Namespace of workbook to retrieve
:param name: Name of workbook to retrieve.
:param namespace: Optional. Namespace of workbook to retrieve.
"""
acl.enforce('workbooks:get', context.ctx())
LOG.debug("Fetch workbook [name=%s]", name)
LOG.debug("Fetch workbook [name=%s, namespace=%s]", name, namespace)
# Use retries to prevent possible failures.
r = rest_utils.create_db_retry_object()
@ -65,7 +65,11 @@ class WorkbooksController(rest.RestController, hooks.HookController):
@rest_utils.wrap_pecan_controller_exception
@pecan.expose(content_type="text/plain")
def put(self, namespace=''):
"""Update a workbook."""
"""Update a workbook.
:param namespace: Optional. Namespace of workbook to update.
"""
acl.enforce('workbooks:update', context.ctx())
definition = pecan.request.text
@ -118,11 +122,12 @@ class WorkbooksController(rest.RestController, hooks.HookController):
def delete(self, name, namespace=''):
"""Delete the named workbook.
:param name: Name of workbook to delete
:param name: Name of workbook to delete.
:param namespace: Optional. Namespace of workbook to delete.
"""
acl.enforce('workbooks:delete', context.ctx())
LOG.debug("Delete workbook [name=%s]", name)
LOG.debug("Delete workbook [name=%s, namespace=%s]", name, namespace)
rest_utils.rest_retry_on_db_error(db_api.delete_workbook)(
name,
@ -163,6 +168,8 @@ class WorkbooksController(rest.RestController, hooks.HookController):
time and date.
:param updated_at: Optional. Keep only resources with specific latest
update time and date.
:param namespace: Optional. Keep only resources with specific
namespace.
"""
acl.enforce('workbooks:list', context.ctx())

View File

@ -104,12 +104,12 @@ class WorkflowsController(rest.RestController, hooks.HookController):
:param identifier: Optional. If provided, it's UUID of a workflow.
Only one workflow can be updated with identifier param.
:param namespace: Optional. If provided int's the namespace of the
workflow/workflows. currently namespace cannot be
:param namespace: Optional. If provided, it's the namespace of the
workflow/workflows. Currently, namespace cannot be
changed.
The text is allowed to have definitions of multiple workflows. In this
case they all will be updated.
The text is allowed to have definitions of multiple workflows. In such
case, they all will be updated.
"""
acl.enforce('workflows:update', context.ctx())
@ -141,12 +141,12 @@ class WorkflowsController(rest.RestController, hooks.HookController):
def post(self, namespace=''):
"""Create a new workflow.
NOTE: The text is allowed to have definitions
of multiple workflows. In this case they all will be created.
:param namespace: Optional. The namespace to create the workflow
in. Workflows with the same name can be added to a given
project if are in two different namespaces.
project if they are in two different namespaces.
The text is allowed to have definitions of multiple workflows.
In such case, they all will be created.
"""
acl.enforce('workflows:create', context.ctx())