YAQL/Jinja function task() w/o arguments fails when a workflow is completing

Bug #1823875 reported by Renat Akhmerov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Renat Akhmerov

Bug Description

The following workflow fails although must finish successfully:

wf:
  tasks:
    task1:
      action: std.fail error_data="Some data"
      on-error:
        - task2: <% task().result != '' %>

    task2:
      action: std.noop

It fails with the error:

Can not evaluate YAQL expression [expression=task().result != '', error=Unknown function "#property#result", data={}]

which means that it can't evaluate "task().result" at some point. However, if we use "task(task1)" then it finishes with SUCCESS.

It happens because the expression under "on-error" clause is evaluated not only when the task ends, but also when Mistral calculates the final workflow context by determining end tasks in each branch and merging their outbound contexts. But determining a end task in a branch involves evaluating expressions under "on-xxx" clauses again to see if there are subsequent tasks. So when it happens, the expression context is not prepared correctly.

Changed in mistral:
milestone: none → train-1
assignee: nobody → Renat Akhmerov (rakhmerov)
importance: Undecided → High
status: New → Confirmed
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/651195

Changed in mistral:
status: Confirmed → In Progress
tags: added: backport stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/651195
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=b0829f943bad10d6caedd0e81484bf9f9e2e7468
Submitter: Zuul
Branch: master

commit b0829f943bad10d6caedd0e81484bf9f9e2e7468
Author: Renat Akhmerov <email address hidden>
Date: Tue Apr 9 18:08:27 2019 +0700

    Fix an expression context for all_errors_handled()

    * "__task_execution" wasn't included in this case into the
      expression data context so the function task() didn't work
      properly

    Change-Id: I3cacae90f9031d09a5e6d8153d728ddc01e1bb21
    Closes-Bug: #1823875

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.openstack.org/651717

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

Reviewed: https://review.openstack.org/651717
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=3429f806aa4f4743ce40d378e165057745508b47
Submitter: Zuul
Branch: stable/stein

commit 3429f806aa4f4743ce40d378e165057745508b47
Author: Renat Akhmerov <email address hidden>
Date: Tue Apr 9 18:08:27 2019 +0700

    Fix an expression context for all_errors_handled()

    * "__task_execution" wasn't included in this case into the
      expression data context so the function task() didn't work
      properly

    Change-Id: I3cacae90f9031d09a5e6d8153d728ddc01e1bb21
    Closes-Bug: #1823875
    (cherry picked from commit b0829f943bad10d6caedd0e81484bf9f9e2e7468)

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

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 8.1.0

This issue was fixed in the openstack/mistral 8.1.0 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.