-
Notifications
You must be signed in to change notification settings - Fork 26
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
♻️🐛 docker engine cleans up volumes when removing dynamic-sidecars #2915
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2915 +/- ##
========================================
- Coverage 79.6% 79.5% -0.1%
========================================
Files 678 681 +3
Lines 28353 28385 +32
Branches 3655 3657 +2
========================================
+ Hits 22578 22594 +16
- Misses 5008 5022 +14
- Partials 767 769 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
||
|
||
@asynccontextmanager | ||
async def docker_client() -> AsyncGenerator[aiodocker.Docker, None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this function 5 times in this repository. I wonder if we could put it in some package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the others but this one is slightly different from the rest.
If the others have the exact same body and signature maybe we could go for such a thing, but in a different PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure? I guess we both have access to the same codebase, right :-) Please verify and create this separate PR if necessary.
@@ -9,6 +9,8 @@ | |||
import pytest | |||
from simcore_service_dynamic_sidecar.modules import mounted_fs | |||
|
|||
pytestmark = pytest.mark.asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanderegg, there was a different way to set this now, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well I think it depends in this case if the pytest-aiohttp library is installed. in which case I think you can just remove the mark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sanderegg pytest-aiohttp is NOT installed but is pytest-asyncio. I thought now it was also automatic .. perhaps i misunderstood some comment you did a while ago
services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/modules/mounted_fs.py
Outdated
Show resolved
Hide resolved
for volume_state_path, state_path in zip( | ||
self.volume_name_state_paths(), self.state_paths | ||
): | ||
yield f"{volume_state_path}:{state_path}" | ||
bind_path: Path = await self._get_bind_path_from_label(volume_state_path) | ||
yield f"{bind_path}:{state_path}" | ||
|
||
|
||
def setup_mounted_fs() -> MountedVolumes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are at least two conventions that are violated here:
_mounted_volumes
: we discourage using global variables. Useapp.state
instead. Please read Data Sharing aka No Singletonget_settings()
: settings should be also inapp.state
and init at the same time as the app but a) is yet another singleton b) is created every-time you call this function (ie. does not "get" but "create" )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've already checked and can confirm the the _mounted_volumes
can be moved to the app instance. For get_settings()
I am not sure. Will also check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So after spending too much time on trying to move part of the get_settings()
away. Will stop for now and leave it for a later PR. It's not that straight forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am a bit surprised this read this since we have been refactoring settings for the whole year ... so i wonder what is the difference here. let's check together
...ices/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/scheduler/events.py
Outdated
Show resolved
Hide resolved
...ices/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/volumes_resolver.py
Outdated
Show resolved
Hide resolved
...ices/director-v2/src/simcore_service_director_v2/modules/dynamic_sidecar/volumes_resolver.py
Outdated
Show resolved
Hide resolved
services/director-v2/tests/unit/test_modules_dynamic_sidecar_volumes_resolver.py
Outdated
Show resolved
Hide resolved
services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/docker_utils.py
Outdated
Show resolved
Hide resolved
services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/docker_utils.py
Outdated
Show resolved
Hide resolved
services/dynamic-sidecar/src/simcore_service_dynamic_sidecar/core/docker_utils.py
Outdated
Show resolved
Hide resolved
@@ -9,6 +9,8 @@ | |||
import pytest | |||
from simcore_service_dynamic_sidecar.modules import mounted_fs | |||
|
|||
pytestmark = pytest.mark.asyncio |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well I think it depends in this case if the pytest-aiohttp library is installed. in which case I think you can just remove the mark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
le'ts give it a try a moment together about the settings
What do these changes do?
Previously the docker volume had to be manually removed from the stack. This never worked on multiple node deployments.
Now the docker engine will take care of cleaning it up.
Note: @mguidon as already discussed with you, this has issues with the docker rclone plugin. Since anonymous volumes are created the docker rclone volume plugin spawns 2/3 times the same anonymous volume, but only one of the ends up being used in the end.
Related issue/s
How to test
Checklist