Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ long running creation of studies #3235

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Aug 5, 2022

What do these changes do?

This PR leverages the new framework for long running REST calls when creating new study in oSparc.
Until now the creation of a study (and its copy with or without data) were done by the webclient calling POST /projects on the webserver. The latter would create a new study, maybe copy data and return a 201 code.

This is now changed to

  • client calls POST /projects with same query parameters
  • webserver answers very fast with a 202 and start creating the new study in the background.
  • client polls GET /tasks/{task_id} to find out when the creation completed
  • client gets the new project by calling GET /tasks/{task_id}/result, server will return a 201 code.

needs #3260

NOTE: this does not handle yet the use case where the webclient is refreshed (via F5) as the new client will not "recover" its current running tasks. In this case if there is copying involved and it is large, then it will still continue in the background without feedback. The new study might appear at some point.

NOTE: this does not handle the use case where the webserver is restarted in the middle of the task. the task is then lost.

Related issue/s

help with ITISFoundation/osparc-issues#558

How to test

Checklist

@sanderegg sanderegg added this to the Brutalism milestone Aug 5, 2022
@sanderegg sanderegg self-assigned this Aug 5, 2022
@codecov
Copy link

codecov bot commented Aug 5, 2022

Codecov Report

Merging #3235 (ed18adb) into master (b54b6fc) will increase coverage by 1.9%.
The diff coverage is 89.7%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master   #3235     +/-   ##
========================================
+ Coverage    82.3%   84.3%   +1.9%     
========================================
  Files         752     548    -204     
  Lines       32119   26005   -6114     
  Branches     4110    3422    -688     
========================================
- Hits        26454   21924   -4530     
+ Misses       4829    3388   -1441     
+ Partials      836     693    -143     
Flag Coverage Δ
integrationtests 66.4% <53.8%> (-0.1%) ⬇️
unittests 80.7% <89.7%> (+1.9%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../simcore_service_webserver/projects/projects_db.py 92.4% <81.8%> (-0.4%) ⬇️
...rvice_webserver/projects/projects_handlers_crud.py 88.1% <90.6%> (+0.4%) ⬆️
...erver/src/simcore_service_webserver/application.py 98.8% <100.0%> (+<0.1%) ⬆️
...k/src/simcore_sdk/node_ports_v2/port_validation.py 47.9% <0.0%> (-48.0%) ⬇️
.../simcore-sdk/src/simcore_sdk/node_ports_v2/port.py 60.6% <0.0%> (-20.0%) ⬇️
...re-sdk/src/simcore_sdk/node_ports_v2/port_utils.py 61.0% <0.0%> (-9.0%) ⬇️
...-sdk/src/simcore_sdk/node_ports_v2/nodeports_v2.py 84.0% <0.0%> (-8.6%) ⬇️
...dk/src/simcore_sdk/node_ports_common/exceptions.py 62.6% <0.0%> (-7.5%) ⬇️
...sdk/src/simcore_sdk/node_ports_v2/ports_mapping.py 93.3% <0.0%> (-6.7%) ⬇️
...rc/simcore_sdk/node_ports_common/storage_client.py 77.7% <0.0%> (-6.2%) ⬇️
... and 216 more

@sanderegg sanderegg force-pushed the enhancement/long_running_creation_of_studies branch 9 times, most recently from f07f028 to 55dc8d3 Compare August 12, 2022 14:00
@sanderegg sanderegg marked this pull request as ready for review August 16, 2022 18:48
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking nice, please find some questions below.

Comment on lines 53 to 57
@pytest.mark.skip(
reason="since long running tasks are now used for copying, this is no longer an issue."
"If the timeout is really super short, then the background task should be properly cancelled."
"this should be tested now"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: why keep the test if no longer required, or did I misunderstand the above message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I had forgotten that one. I need to adapt the test.

@sanderegg sanderegg requested a review from GitHK August 18, 2022 06:40
Copy link
Contributor

@GitHK GitHK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 It's fine with me.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sanderegg sanderegg merged commit a7867c3 into ITISFoundation:master Aug 18, 2022
@sanderegg sanderegg deleted the enhancement/long_running_creation_of_studies branch August 18, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants