"version" field doesn't get injected properly into task specifications when using spec_parser.get_task_spec()

Bug #1468419 reported by Renat Akhmerov
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Guy Paz

Bug Description

Seems like "version" field doesn't get injected properly into task specifications when using spec_parser.get_task_spec().

Needs to be verified.

Changed in mistral:
importance: Undecided → High
milestone: none → liberty-1
Changed in mistral:
assignee: nobody → Nikolay Makhotkin (nmakhotkin)
Revision history for this message
Guy Paz (guy-paz) wrote :

if that info help :
Encountered this issue for the task in test : "test_get_task_execution_result"

File "mistral/workbook/parser.py", line 49, in _get_spec_version if 'version' in spec_dict: TypeError: argument of type 'NoneType' is not iterable

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

Please see this test: https://github.com/openstack/mistral/blob/master/mistral/tests/unit/workbook/v2/test_workbook.py#L30-L221

Version injection also is tested there, see lines 37, 48, 69, 84, 105, 116 and 140.

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

I really don't know how is this test executed with error: it is always successful for me. Could you please add more details on that?

Changed in mistral:
status: New → Incomplete
Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

Ooh, it seems like that test (test_get_task_execution_result) is a bit incorrect: https://github.com/openstack/mistral/blob/master/mistral/tests/unit/engine/test_dataflow.py#L465

Please see, here we manually create a task execution object without the spec. That's why it is 'None' for this test. Adding simple task spec should solve this problem.

Revision history for this message
Guy Paz (guy-paz) wrote :

I know. This is what I thought ...

So actually test need a fix . I started to add manually in the code : 'version' and then 'workflow_type' ...
But since I didnt want to touch too much in this test I advise with Renat and then we opened the bug.

If you want me to work on I need an example how to add "simple task spec" .

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

Yes. Simple task spec is dict in TaskExecution object and we can create it using:

TaskExecution(
name='task1',
spec={
                "version": '2.0',
                'name': 'task1',
                'with-items': 'var in [1]',
                'type': 'direct'
            }
)

and then we can import parser in dataflow.py and get the TaskSpec object:

from mistral.workbook import parser

...

task_spec = parser.get_task_spec(task_ex.spec)

Revision history for this message
Nikolay Makhotkin (nmakhotkin) wrote :

ooh, indentation is really bad

Changed in mistral:
milestone: liberty-1 → liberty-2
Guy Paz (guy-paz)
Changed in mistral:
assignee: Nikolay Makhotkin (nmakhotkin) → Guy Paz (guy-paz)
Changed in mistral:
status: Incomplete → In Progress
Changed in mistral:
status: In Progress → Fix Committed
Changed in mistral:
status: Fix Committed → Fix Released
Changed in mistral:
milestone: liberty-2 → liberty
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.