-
Notifications
You must be signed in to change notification settings - Fork 192
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
Engine: Fix bug in upload calculation for PortableCode
with SSH
#6519
Merged
sphuber
merged 1 commit into
aiidateam:main
from
sphuber:fix/6518/portable-code-ssh-transport
Jul 5, 2024
Merged
Engine: Fix bug in upload calculation for PortableCode
with SSH
#6519
sphuber
merged 1 commit into
aiidateam:main
from
sphuber:fix/6518/portable-code-ssh-transport
Jul 5, 2024
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
When a `CalcJob` would be run with a `PortableCode` using a computer configured with the `core.ssh` transport plugin, the upload task would except. The `aiida.engine.daemon.execmanager.upload_calculation` method is passing `pathlib.Path` objects to the transport interface which is not supported. By chance this does not raise an exception when using the `LocalTransport`, but the `SshTransport` passes these values to the paramiko library which does choke on anything but strings. The use of a `PortableCode` was tested for in the unit test `tests/engine/processes/calcjobs/test_calc_job.py:test_portable_code` but this would only use a local transport and thus the bug would not appear. Parametrizing it to also use the `SshTransport` wouldn't help since the test uses `metadata.dry_run = True`, whose implementation will always swap the transport to a local one, still avoiding the bugged code pathway. Instead a test is added that directly calls `upload_calculation` which parametrizes over all installed transport plugins and uses a `PortableCode`. This confirmed the bug. The `upload_calculation` method is updated to ensure casting all `pathlib.Path` objects to `str` before passing it to the transport.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6519 +/- ##
==========================================
+ Coverage 77.51% 77.79% +0.29%
==========================================
Files 560 561 +1
Lines 41444 41820 +376
==========================================
+ Hits 32120 32530 +410
+ Misses 9324 9290 -34 ☔ View full report in Codecov by Sentry. |
giovannipizzi
approved these changes
Jul 4, 2024
sphuber
added a commit
that referenced
this pull request
Aug 7, 2024
) When a `CalcJob` would be run with a `PortableCode` using a computer configured with the `core.ssh` transport plugin, the upload task would except. The `aiida.engine.daemon.execmanager.upload_calculation` method is passing `pathlib.Path` objects to the transport interface which is not supported. By chance this does not raise an exception when using the `LocalTransport`, but the `SshTransport` passes these values to the paramiko library which does choke on anything but strings. The use of a `PortableCode` was tested for in the unit test `tests/engine/processes/calcjobs/test_calc_job.py:test_portable_code` but this would only use a local transport and thus the bug would not appear. Parametrizing it to also use the `SshTransport` wouldn't help since the test uses `metadata.dry_run = True`, whose implementation will always swap the transport to a local one, still avoiding the bugged code pathway. Instead a test is added that directly calls `upload_calculation` which parametrizes over all installed transport plugins and uses a `PortableCode`. This confirmed the bug. The `upload_calculation` method is updated to ensure casting all `pathlib.Path` objects to `str` before passing it to the transport. Cherry-pick: f992443
mikibonacci
pushed a commit
to mikibonacci/aiida-core
that referenced
this pull request
Sep 3, 2024
…idateam#6519) When a `CalcJob` would be run with a `PortableCode` using a computer configured with the `core.ssh` transport plugin, the upload task would except. The `aiida.engine.daemon.execmanager.upload_calculation` method is passing `pathlib.Path` objects to the transport interface which is not supported. By chance this does not raise an exception when using the `LocalTransport`, but the `SshTransport` passes these values to the paramiko library which does choke on anything but strings. The use of a `PortableCode` was tested for in the unit test `tests/engine/processes/calcjobs/test_calc_job.py:test_portable_code` but this would only use a local transport and thus the bug would not appear. Parametrizing it to also use the `SshTransport` wouldn't help since the test uses `metadata.dry_run = True`, whose implementation will always swap the transport to a local one, still avoiding the bugged code pathway. Instead a test is added that directly calls `upload_calculation` which parametrizes over all installed transport plugins and uses a `PortableCode`. This confirmed the bug. The `upload_calculation` method is updated to ensure casting all `pathlib.Path` objects to `str` before passing it to the transport.
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 #6518
When a
CalcJob
would be run with aPortableCode
using a computer configured with thecore.ssh
transport plugin, the upload task would except. Theaiida.engine.daemon.execmanager.upload_calculation
method is passingpathlib.Path
objects to the transport interface which is not supported. By chance this does not raise an exception when using theLocalTransport
, but theSshTransport
passes these values to the paramiko library which does choke on anything but strings.The use of a
PortableCode
was tested for in the unit testtests/engine/processes/calcjobs/test_calc_job.py:test_portable_code
but this would only use a local transport and thus the bug would not appear. Parametrizing it to also use theSshTransport
wouldn't help since the test usesmetadata.dry_run = True
, whose implementation will always swap the transport to a local one, still avoiding the bugged code pathway.Instead a test is added that directly calls
upload_calculation
which parametrizes over all installed transport plugins and uses aPortableCode
. This confirmed the bug. Theupload_calculation
method is updated to ensure casting allpathlib.Path
objects tostr
before passing it to the transport.