Initialize the lazily loaded execution "input" field in API

* After the recent change that made all potentially heavy fields
  of execution objects lazily loaded, some clients using Mistral
  APIs started crashing because they expect to get "input" field
  in JSON of execution objects that Mistral API returns. It wasn't
  present though because we did not initialize it explicitly in
  the API controller.
* Unfortunately, there's no easy way now to cover this change in
  the API tests just for how they are organized: they mock all
  DB calls and return all fields already initialized. We may want
  to refactor these tests moving forward.

Change-Id: I683c79fa0a3ab23a16c493ce2314a506dfee9749
This commit is contained in:
Renat Akhmerov 2019-06-24 11:06:59 +03:00
parent f75e7198c6
commit dfc3277ffd
1 changed files with 3 additions and 3 deletions

View File

@ -64,13 +64,13 @@ def _load_deferred_fields(ex, fields):
def _get_workflow_execution_resource_with_output(wf_ex):
_load_deferred_fields(wf_ex, ['params', 'output'])
_load_deferred_fields(wf_ex, ['params', 'input', 'output'])
return resources.Execution.from_db_model(wf_ex)
def _get_workflow_execution_resource(wf_ex):
_load_deferred_fields(wf_ex, ['params'])
_load_deferred_fields(wf_ex, ['params', 'input'])
return resources.Execution.from_db_model(wf_ex)
@ -84,7 +84,7 @@ def _get_workflow_execution(id, must_exist=True):
else:
wf_ex = db_api.load_workflow_execution(id)
return _load_deferred_fields(wf_ex, ['params', 'output'])
return _load_deferred_fields(wf_ex, ['params', 'input', 'output'])
# TODO(rakhmerov): Make sure to make all needed renaming on public API.