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

Implement a ProcessBuilder to normalize the launching of processes #1116

Merged
merged 10 commits into from
Feb 14, 2018

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Feb 13, 2018

Fixes #1063

Could still potentially do with some cleaning of the various places of the top level run and submit functions, i.e. deprecate the old aiida.work.run module.
We also may want to add deprecations to the old JobCalculation.submit() methods that bypass the new process system. As well as the new_calc() method of the Code entity

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
@sphuber sphuber requested a review from muhrin February 13, 2018 21:17
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 muhrin merged commit 03a7bca into aiidateam:workflows Feb 14, 2018
@sphuber sphuber deleted the fix_1063_process_builder branch February 14, 2018 17:20
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.

2 participants