task() without a given task name doesn't work within on-complete

Bug #1664625 reported by Dougal Matthews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Anastasia Kuznetsova

Bug Description

The task() expression function should return the current task if no name is provided. However, this doesn't work within the on-complete section of a task.

Take a look at the following session to see this issue. Note that the state info is different in the execution list at the end

Paste with better formatting: http://paste.openstack.org/show/598856/

[stack@undercloud ~]$ cat taskfn.yaml
---
version: '2.0'

name: taskfn

workflows:

  wf1:
    tasks:
      task_a:
        action: std.echo output="test"
        on-complete:
          - fail(msg=<% task() %>)

  wf2:
    tasks:
      task_a:
        action: std.echo output="test"
        on-complete:
          - fail(msg=<% task(task_a) %>)
[stack@undercloud ~]$ mistral execution-create taskfn.wf1
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| ID | 3d4300cf-d43c-48a3-a1bc-27ec12c34d65 |
| Workflow ID | 3463c36b-6a40-4999-aff3-52f5fc99f9f7 |
| Workflow name | taskfn.wf1 |
| Description | |
| Task Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2017-02-14 16:12:24 |
| Updated at | 2017-02-14 16:12:24 |
+-------------------+--------------------------------------+
[stack@undercloud ~]$ mistral execution-create taskfn.wf2
+-------------------+--------------------------------------+
| Field | Value |
+-------------------+--------------------------------------+
| ID | a27e83e1-c653-43ea-a79f-99b238d7e7c7 |
| Workflow ID | c00968bc-f50e-4660-bc53-26f1b0842821 |
| Workflow name | taskfn.wf2 |
| Description | |
| Task Execution ID | <none> |
| State | RUNNING |
| State info | None |
| Created at | 2017-02-14 16:12:34 |
| Updated at | 2017-02-14 16:12:34 |
+-------------------+--------------------------------------+
[stack@undercloud ~]$ mistral execution-list
+--------------------------------------+--------------------------------------+---------------+-------------+-------------------+-------+------------------------------+---------------------+---------------------+
| ID | Workflow ID | Workflow name | Description | Task Execution ID | State | State info | Created at | Updated at |
+--------------------------------------+--------------------------------------+---------------+-------------+-------------------+-------+------------------------------+---------------------+---------------------+
| 3d4300cf-d43c-48a3-a1bc-27ec12c34d65 | 3463c36b-6a40-4999-aff3-52f5fc99f9f7 | taskfn.wf1 | | <none> | ERROR | None | 2017-02-14 16:12:24 | 2017-02-14 16:12:24 |
| a27e83e1-c653-43ea-a79f-99b238d7e7c7 | c00968bc-f50e-4660-bc53-26f1b0842821 | taskfn.wf2 | | <none> | ERROR | {'state_info': None, 'nam... | 2017-02-14 16:12:34 | 2017-02-14 16:12:34 |
+--------------------------------------+--------------------------------------+---------------+-------------+-------------------+-------+------------------------------+---------------------+---------------------+

Changed in mistral:
milestone: none → pike-1
Changed in mistral:
assignee: nobody → Anastasia Kuznetsova (akuznetsova)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/451340

Changed in mistral:
status: Confirmed → In Progress
Changed in mistral:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/451340
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=7d4fb7dbc247c46761ad23a5c01060ba1baa3a4a
Submitter: Jenkins
Branch: master

commit 7d4fb7dbc247c46761ad23a5c01060ba1baa3a4a
Author: Anastasia Kuznetsova <email address hidden>
Date: Wed Mar 29 15:06:34 2017 +0400

    Fix work of task() without task name within on-clause cases

    Information about current task was removed from context too early.
    As a result, it wasn't possible to get needed info from db during
    task() yaql function processing without given task name.

    Method "remove_current_task_from_context" was renamed to
    "remove_internal_data_from_context" to have an ability to
    use it in future for more common needs.

    Change-Id: I14ba7b791b0ac7055f8c2cec3065833c60589c10
    Closes-Bug: #1664625

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 5.0.0.0b1

This issue was fixed in the openstack/mistral 5.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/465808

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (stable/ocata)

Reviewed: https://review.openstack.org/465808
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=ce3bec77804c491cc560d77b2c3227fc806952d3
Submitter: Jenkins
Branch: stable/ocata

commit ce3bec77804c491cc560d77b2c3227fc806952d3
Author: Anastasia Kuznetsova <email address hidden>
Date: Wed Mar 29 15:06:34 2017 +0400

    Fix work of task() without task name within on-clause cases

    Information about current task was removed from context too early.
    As a result, it wasn't possible to get needed info from db during
    task() yaql function processing without given task name.

    Method "remove_current_task_from_context" was renamed to
    "remove_internal_data_from_context" to have an ability to
    use it in future for more common needs.

    Change-Id: I14ba7b791b0ac7055f8c2cec3065833c60589c10
    Closes-Bug: #1664625
    (cherry picked from commit 7d4fb7dbc247c46761ad23a5c01060ba1baa3a4a)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 4.0.2

This issue was fixed in the openstack/mistral 4.0.2 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.