Skip to content
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

Add the retrieve_temporary_list member to the CalcInfo datastructure #892

Merged

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Nov 6, 2017

Fixes #886

For some calculation one wants to retrieve certain files for parsing
but does not want to store them permanently in the repository because
for example they may take up a lot of space. To facilitate for this
use case we introduce the concept of the retrieve_temporary_list member
in the CalcInfo datastructure. Implementations of a Calculation can
opt to provide a list of directives, identical to that of the original
retrieve_list member, that will instruct the exectution manager to
retrieve those files to a local folder for parsing. The difference is
that the files listed in the retrieve_temporary_list member will be
stored in a FolderData node that will not be stored in the database
and which will only be alive for the duration of the parsing. After
parsing is completed the retrieved files are garbage collected.
Copy link
Member

@giovannipizzi giovannipizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor fixes

# ['remotepath','localpath',depth] ]
'retrieve_temporary_list', # a list of files or patters to retrieve that will only be kept during parsing and will be deleted after parsing is completed
# possible formats: ['remotepath', # just the name of the file to retrieve. Will be put in '.' of the repository with name os.path.split(item)[1]
# ['remotepath','localpath', depth]]
# second format will copy the remotepath file/folder to localpath.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment belongs still to 'retrieve_list', whose description is not 'cut'

@@ -806,6 +771,7 @@ def retrieve_computed_for_authinfo(authinfo):
calc.pk, retrieved_files.dbnode.pk),
extra=logger_extra)
retrieved_files.store()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment that we are not storing the _temp files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fine for me. I'll approve this and let you merge or decide to put an explicit clear of the SandboxFolder for the temporary FolderData

giovannipizzi
giovannipizzi previously approved these changes Nov 6, 2017
Also deleted the link that was added to the retrieved_temporary_folder
which was a left over from testing phase. Since the FolderData is
never going to be stored, it also shouldn't have any links
The parser will not do anything, but if the 'retrieve_temporary_files'
key was set in the 'template' input node, then it is expected that
those files will be temporarily stored in an unstored FolderData node
which should be passed in the 'retrieved' argument of the
parse_with_retrieved call of the Parser class. In that case, the
arguments are checked for the presence of the unstored FolderData node
@sphuber sphuber force-pushed the fix_886_retrieve_temporary_list branch 7 times, most recently from 634e4ba to bc6bdcf Compare November 6, 2017 22:10
The daemon integration test leverages the TemplatereplacerCalculation
to launch some trivial calculations. We add the output filepath to the
'retrieve_temporary_files' entry of the template dictionary which will
cause the TemplatereplacerParser class to check for an unstored
FolderData node containing those files, which should be passed to the
parse_with_retrieved function called by the execmanager
@sphuber sphuber force-pushed the fix_886_retrieve_temporary_list branch from bc6bdcf to 1ea8548 Compare November 6, 2017 22:17
@sphuber sphuber requested a review from giovannipizzi November 6, 2017 22:26
@sphuber
Copy link
Contributor Author

sphuber commented Nov 6, 2017

I have added a TemplatereplacerParser that does nothing but verify that, if a retrieve_file_list was specified in the template input node of the TemplatereplacerCalculation, that the temporary folder is passed to the parse_with_retrieved call by the execmanager. It seems to work, but I am not sure if this check is enough

nmounet
nmounet previously approved these changes Nov 7, 2017
Copy link

@nmounet nmounet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Also enhance the parser by explicitly verifying that all the files
that are listed in the 'template' input node in the retrieve_temp_list
key are present in the temporary folder
@sphuber sphuber force-pushed the fix_886_retrieve_temporary_list branch 3 times, most recently from 8f7e1d5 to fad81b4 Compare November 7, 2017 10:03
This means that the parsing of the output file can be moved from
the daemon test to the actual parser itself
@sphuber sphuber force-pushed the fix_886_retrieve_temporary_list branch from fad81b4 to 53c3479 Compare November 7, 2017 10:16
Copy link
Member

@giovannipizzi giovannipizzi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the most recent modifications, that actually test the content of the temporarily retrieved files, it's ready to be merged

@giovannipizzi giovannipizzi merged commit 8654f96 into aiidateam:develop Nov 7, 2017
@sphuber sphuber deleted the fix_886_retrieve_temporary_list branch November 7, 2017 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants