reanahub / reana-workflow-controller

REANA Workflow Controller
http://reana-workflow-controller.readthedocs.io/
MIT License
2 stars 38 forks source link

rest: get_workflows, job progress is queried for each workflow despite being not included in the response #415

Closed VMois closed 3 years ago

VMois commented 3 years ago

In the get_workflows API when include_progress is not passed (= False), job progress is still queried from DB.

Listing from get_workflow_progress function:

Jobs are queried at the beginning:

https://github.com/reanahub/reana-workflow-controller/blob/d650d0c059ff17bd3b62d5e34addfa1af9e24c1c/reana_workflow_controller/rest/utils.py#L636-L641

But only used and may be included only here:

https://github.com/reanahub/reana-workflow-controller/blob/d650d0c059ff17bd3b62d5e34addfa1af9e24c1c/reana_workflow_controller/rest/utils.py#L658-L671

In case the user doesn't want to include progress, unnecessary queries are still performed. For 1000 workflows, it potentially increases response time a lot.

mvidalgarcia commented 3 years ago

Good catch. Also, that try-except is not very pretty.