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

Fix/storage project copy #2301

Merged
merged 11 commits into from
Apr 29, 2021

Conversation

pcrespov
Copy link
Member

@pcrespov pcrespov commented Apr 28, 2021

What do these changes do?

Webserver cannot create a new project from template because storage cancels when copying template data in s3.

Problem

Storage cancels the handler because the client (i.e. the web-server) times out. Notice that the cancelation is while creating a client (see here)

Here we can see relevant part of the logs

  • storage: "POST /v0/simcore-s3/folders". Responding with status 500
ERROR:servicelib.rest_middlewares:Unexpected server error "<class 'concurrent.futures._base.CancelledError'>" from access: 10.3.95.151 "POST /v0/simcore-s3/folders". Responding with status 500
Traceback (most recent call last):
 ...
  File "/home/scu/.venv/lib/python3.6/site-packages/simcore_service_storage/handlers.py", line 355, in create_folders_from_project
    user_id, source_project, destination_project, nodes_map
  File "/home/scu/.venv/lib/python3.6/site-packages/simcore_service_storage/dsm.py", line 757, in deep_copy_project_simcore_s3
    Bucket=self.simcore_bucket_name, Prefix=source_folder
  File "/home/scu/.venv/lib/python3.6/site-packages/aiobotocore/client.py", line 121, in _make_api_call
    operation_model, request_dict, request_context)
...  
  File "/home/scu/.venv/lib/python3.6/site-packages/aiohttp/streams.py", line 604, in read
    await self._waiter
concurrent.futures._base.CancelledError <<<

  • webserver: "POST /v0/projects" done in 20.20 secs. Responding with status 500
ERROR: simcore_service_webserver.diagnostics_monitoring:_middleware_handler(110) - Unexpected server error "<class 'aiohttp.web_exceptions.HTTPInternalServerError'>" from access: 10.3.95.28 "POST /v0/projects" done in 20.20 secs. Responding with status 500
Traceback (most recent call last):
 ...
  File "/home/scu/.venv/lib/python3.6/site-packages/simcore_service_webserver/projects/projects_handlers.py", line 122, in create_projects
    await clone_data_coro
  File "/home/scu/.venv/lib/python3.6/site-packages/simcore_service_webserver/storage_api.py", line 44, in copy_data_folders_from_project
    ssl=False,
  File "/home/scu/.venv/lib/python3.6/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/scu/.venv/lib/python3.6/site-packages/aiohttp/client.py", line 504, in _request
    await resp.start(conn)
  File "/home/scu/.venv/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 860, in start
    self._continue = None
  File "/home/scu/.venv/lib/python3.6/site-packages/aiohttp/helpers.py", line 596, in __exit__
    raise asyncio.TimeoutError from None
concurrent.futures._base.TimeoutError <<<<<<

Hightlights

  • refactors in storage create_folders_from_project -> deep_copy_project_simcore_s3
    • aiobotocore session is created only once instead of upon every call
  • upgrades requirements
  • Creates tests/performance with Locust .
    • Currently only enabled for manual testing of this issue
    • Tested with 100 parallel users for 569 requests w/o failures

Related issue/s

How to test

cd osparc-simcore
make devenv
source .venv/bin/activate
cd services/storage
make install-dev
make tests

For manual testing,

  • build and deploy stack
cd osparc-simcore
make build-x
make up-prod
  • register, login, create a template project and share with everybody
  • set the UUID of this template project in test/performance/.env
cd osparc-simcore/tests/performance
make install-dev
make .env
  • start locust
make start

and this is the projects of one of the fake users:
image

@codecov
Copy link

codecov bot commented Apr 28, 2021

Codecov Report

Merging #2301 (62c44f6) into master (db25cb7) will increase coverage by 0.0%.
The diff coverage is 67.8%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #2301   +/-   ##
======================================
  Coverage    71.8%   71.8%           
======================================
  Files         505     505           
  Lines       19857   19851    -6     
  Branches     1948    1946    -2     
======================================
+ Hits        14266   14267    +1     
+ Misses       5117    5113    -4     
+ Partials      474     471    -3     
Flag Coverage Δ
integrationtests 62.0% <ø> (+<0.1%) ⬆️
unittests 67.2% <67.8%> (+<0.1%) ⬆️

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

Impacted Files Coverage Δ
...ervices/storage/src/simcore_service_storage/dsm.py 72.6% <67.8%> (+0.2%) ⬆️
.../director/src/simcore_service_director/producer.py 61.5% <0.0%> (+0.8%) ⬆️

@pcrespov pcrespov self-assigned this Apr 28, 2021
@pcrespov pcrespov added the a:storage issue related to storage service label Apr 28, 2021
@pcrespov pcrespov added this to the Schwarznasenschaf milestone Apr 28, 2021
@pcrespov pcrespov changed the title WIP: Fix/storage project copy Fix/storage project copy Apr 28, 2021
@pcrespov pcrespov marked this pull request as ready for review April 28, 2021 18:41
@pcrespov pcrespov added the bug buggy, it does not work as expected label Apr 28, 2021
Copy link
Member

@sanderegg sanderegg left a comment

Choose a reason for hiding this comment

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

pair reviewed. Very nice!

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.

Looks nice. Some questions below.

tests/performance/Makefile Show resolved Hide resolved
@pcrespov pcrespov merged commit ce98441 into ITISFoundation:master Apr 29, 2021
@pcrespov pcrespov deleted the fix/storage-project-copy branch April 29, 2021 08:06
@pcrespov pcrespov mentioned this pull request Apr 29, 2021
14 tasks
@pcrespov pcrespov mentioned this pull request Jun 21, 2021
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:storage issue related to storage service bug buggy, it does not work as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants