forked from aiidateam/aiida-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CalcJob
: Allow to define order of copying of input files (aiidateam…
…#6285) There are three different sources of files that are copied to the working directory on the remote computer where a calculation job is executed: * Sandbox: files written to a temporary sandbox folder on the local file system written by the `CalcJob` plugin, first in the `prepare_for_submission` method, followed by the `presubmit` of the base class. * Local: files written to the temporary sandbox folder by the engine based on the `local_copy_list` defined by the plugin in the `prepare_for_submission` method. * Remote: files written directly to the remote working directory by the engine base on the `remote_copy_list` defined by the plugin in the `prepare_for_submission` method. Historically, these operations were performed in the order of sandbox, local and remote. For certain use cases, however, this was deemed non-ideal, for example because files from the remote would override files written by the plugin itself in the sandbox. This enum can be assigned to the `CalcInfo` instance returned by the calculation job plugin `prepare_for_submission` implementation to change the order. Here, a new attribute `file_copy_operation_order` is added to the `CalcInfo` datastructure. It takes a list of instance of the `FileCopyOperation` enum. The enum defines the types of file copy operations that exist, and the `CalcInfo` attribute specifies the order in which they should be executed. This design makes it flexible to the potential addition of other file copy operations in the future. The default value is set to the current order of sandbox, local, remote. It is set both in the `CalcJob.presubmit` in case the plugin implementation did not explicitly specify it (where it is also type checked) as well in the `upload_calculation` function, which is sometimes directly without going through `CalcJob.presubmit` in which case the default wouldn't be set. To simplify the implementation, the code to copy these three types of files are factored out of the `upload_calculation` function to the functions `_copy_remote_files`, `_copy_remote_files` and `_copy_sandbox_files` functions, respectively. Finally, the original approach would not actually copy the local and sandbox files separately directly to the remote working directory. Rather, it would copy the local files to the sandbox, and then the contents of the entire sandbox would be copied over. This required updating the `provenance_exclude_list` with the files added from the `local_copy_list` because they should not be copied to the node's repository. The implementation is simplified by copying the local files directly to the working directory, instead of going through the sandbox. Since the transport interface only works with files and not streams in memory, the implementation is still forced to first copy the local files to a temporary directory on disk before copying them over to the working directory using the transport.
- Loading branch information
Showing
6 changed files
with
318 additions
and
94 deletions.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.