Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Call reset when remove profile #189
base: main
Are you sure you want to change the base?
Call reset when remove profile #189
Changes from all commits
0f03ef7
0e6f26b
b1bc7dc
a0ebfd3
a4549ff
79eb2db
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Please also assert that the volumes were indeed deleted, while for the first profile we should assert that they were NOT deleted.
Because the volumes are not automatically created when the profile is created, we probably need a fixture for that. I think there should be be an existing fixture you might be able to reuse or use directly).
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 didn't test this since it was covered by the
TestLifeCycle
below. This pr does not include adding new feature but it calls reset to remove.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 tried to move
get_volume
out and reuse it for this purge option, but give up since I realize it break the good design of usinginstance
fixture as the class scope and cleaned up it after the test was finalized.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.
Thanks for taking a look. I think my idea was more simple. Instead of launching the whole lifecycle, you would create the docker volumes manually in the fixture.
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 have a second try and found the problem is the profile and container serve two different cases. When user run
aiidalab-launch profile
it only create the profile but did nothing with container and the volume. It is when the profile first time used the container and its volumes are created.If you try with
-vvv
with this pr branch, you'll find that before the newly creating profile first time running, running with--purge
will go throughreset
which manipulate docker container directly and hit the code pathaiidalab-launch/aiidalab_launch/instance.py
Lines 239 to 242 in 33c7a26
It won't cause any issues because it logs to the debug level. I am now not very confident in myself it is a good way to implement the purge here which mixes the profile and container controlling part of the code.
From what you are asking here, it is useless to create docker volume fixture because in this test, only the profile is created but not the container. So it has to go to the real life cycle which has the container running with volumes created.
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.
In fact, I think the profile concept is not very useful to end user. If we regard
aiidalab-launch
as a wrapper of a combination of multiple docker commands, it maybe makes sense to have the CLI command match with the docker command which are:docker run
->aiidalab-launch run
: to start from an image. (this will be the combination of currentaiidalab-launch profile add
+aiidalab-launch profile start
)docker stop
->aiidalab-launch stop
: stop the container, it is the same from what it is now.docker rm
->aiidalab-launch rm
: remove the container (for aiidalab-launch case also remove the volume), this is then what I was going to achieve in this PR. It is the combination of the currentaiidalab-launch reset
andaiidalab-launch profile remove
.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.
Hi @danielhollas, can you give this a look? We can then decide we halt this PR or continue it with brining some mixture of profile and container commands.