Implement a ProcessBuilder to normalize the launching of processes#1116
Merged
Conversation
The ProcessBuilder will effectively create a FixedFieldsAttributeDict where the allowed fields correspond to the input ports of the Process class that it is created for. This will provide autocomplete functionality to the user with default values already populated. A single additional method launch() allows the Process to be submitted or ran with the current state of the attributes dictionary as the inputs dictionary. This also satisfies that the user does not have to import the run or submit functions
Moved the aiida specific implementations of the ProcessSpec and the Ports to separate files for clarity. Also cleaned up the aiida.work.processes file with respect to imports
The attributes of a ProcessBuilder instance correspond to the names
of the input ports of the process spec that it was created for. The
InputPorts in that ProcessSpec contain all the information that a
user might need, such as a help text, valid types and optional default
values, so it would be good to have that information show up as the
docstring of the attributes of the ProcessBuilder. This is now
implemented and means that the docstring can be viewed interactively
> PwCalculation = CalculationFactory('quantumespresso.pw')
> builder = PwCalculation.get_builder()
> builder.parameters?
Type: ProcessBuilderInput
String form: None
File: ~/code/aiida/env/workflows/aiida-core/aiida/work/process_builder.py
Docstring: {
"help": "Use a node that specifies the input parameters for the namelists",
"name": "parameters",
"valid_type": "<class 'aiida.orm.data.parameter.ParameterData'>"
}
This gives the user all the information they need while never having
to leave the interactive shell
The JobCalculation class has a method called submit_test that allows a user to create a fully qualified Calculation node in memory, without storing it to the database, nor any of its inputs, while creating the actual calculation directory that would be created on launch. This is useful to inspect whether the input files that would be generated based on the current inputs, would be correct, without actually having to submit it to the scheduler or storing it in the database. This functionality is now supported through the ProcessBuilder by subclassing it to the JobProcessBuilder which will be returned for JobProcesses when calling get_builder() since this functionality only makes sense for JobProcesses and not Processes in general. The launch method of this builder takes the optional argument 'test' that is False by default, but when set to True will create the submit test folder
These operations should be discouraged as the creation and submission of JobCalculations should be done through the Process system with for example the ProcessBuilder
muhrin
approved these changes
Feb 14, 2018
This file contains hidden or 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
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 #1063
Could still potentially do with some cleaning of the various places of the top level
runandsubmitfunctions, i.e. deprecate the oldaiida.work.runmodule.We also may want to add deprecations to the old
JobCalculation.submit()methods that bypass the new process system. As well as thenew_calc()method of theCodeentity