-
Notifications
You must be signed in to change notification settings - Fork 224
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
Make the execmanager.upload_calculation
idempotent'ish
#3146
Merged
sphuber
merged 1 commit into
aiidateam:develop
from
sphuber:fix_3142_execmanager_upload_calculation_idempotence
Jul 9, 2019
Merged
Make the execmanager.upload_calculation
idempotent'ish
#3146
sphuber
merged 1 commit into
aiidateam:develop
from
sphuber:fix_3142_execmanager_upload_calculation_idempotence
Jul 9, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2ab663c
to
ddb6d95
Compare
execmanager.upload_calculation
idempotent as best as possibleexecmanager.upload_calculation
idempotent as best as possible
execmanager.upload_calculation
idempotent as best as possibleexecmanager.upload_calculation
idempotent'ish
@giovannipizzi this is now unblocked and ready for review |
Could you put a comment also here when calling |
The `upload_calculation` would cause an exception if called multiple times for the same calculation, which can happen if the first time that the runner was working on it got interrupted, for example due to a daemon shutdown. The reason is that the second time around the adding of the `remote_folder` data node will raise a uniqueness exception, because there can only be one output with the same label. Note that full idem-potency is impossible, but this change should make the problem a lot less likely to occur. The idea is to delay the actual attaching of the remote folder data node to the last moment possible. This way, if the method is called again and the folder is already there, we can be reasonably sure that the files were already retrieved successfully and we simply return, leaving the call a no-op. This is done in the beginning of the function to check if the output node already exists using the `LinkManager.first()` call. If the node exists, the upload function has apparently already been called before and reached the end of the function where it adds the remote folder. This means all the files were already successfully uploaded so we can safely skip it.
ddb6d95
to
629385b
Compare
Done. I also noticed I made a mistake in the return value of the initial check. Now it also returns the correct tuple |
giovannipizzi
approved these changes
Jul 9, 2019
d-tomerini
pushed a commit
to d-tomerini/aiida_core
that referenced
this pull request
Sep 30, 2019
) The `upload_calculation` would cause an exception if called multiple times for the same calculation, which can happen if the first time that the runner was working on it got interrupted, for example due to a daemon shutdown. The reason is that the second time around the adding of the `remote_folder` data node will raise a uniqueness exception, because there can only be one output with the same label. Note that full idem-potency is impossible, but this change should make the problem a lot less likely to occur. The idea is to delay the actual attaching of the remote folder data node to the last moment possible. This way, if the method is called again and the folder is already there, we can be reasonably sure that the files were already retrieved successfully and we simply return, leaving the call a no-op. This is done in the beginning of the function to check if the output node already exists using the `LinkManager.first()` call. If the node exists, the upload function has apparently already been called before and reached the end of the function where it adds the remote folder. This means all the files were already successfully uploaded so we can safely skip it.
d-tomerini
pushed a commit
to d-tomerini/aiida_core
that referenced
this pull request
Oct 16, 2019
) The `upload_calculation` would cause an exception if called multiple times for the same calculation, which can happen if the first time that the runner was working on it got interrupted, for example due to a daemon shutdown. The reason is that the second time around the adding of the `remote_folder` data node will raise a uniqueness exception, because there can only be one output with the same label. Note that full idem-potency is impossible, but this change should make the problem a lot less likely to occur. The idea is to delay the actual attaching of the remote folder data node to the last moment possible. This way, if the method is called again and the folder is already there, we can be reasonably sure that the files were already retrieved successfully and we simply return, leaving the call a no-op. This is done in the beginning of the function to check if the output node already exists using the `LinkManager.first()` call. If the node exists, the upload function has apparently already been called before and reached the end of the function where it adds the remote folder. This means all the files were already successfully uploaded so we can safely skip it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #3145
The
upload_calculation
would cause an exception if called multipletimes for the same calculation, which can happen if the first time that
the runner was working on it got interrupted, for example due to a
daemon shutdown. The reason is that the second time around the adding of
the
remote_folder
data node will raise a uniqueness exception,because there can only be one output with the same label.
Note that full idem-potency is impossible, but this change should make
the problem a lot less likely to occur. The idea is to delay the actual
attaching of the remote folder data node to the last moment possible.
This way, if the method is called again and the folder is already there,
we can be reasonably sure that the files were already retrieved
successfully and we simply return, leaving the call a no-op. This is
done in the beginning of the function to check if the output node already
exists using the
LinkManager.first()
call. If the node exists, theupload function has apparently already been called before and reached
the end of the function where it adds the remote folder. This means all
the files were already successfully uploaded so we can safely skip it.