aiida.orm.calculation.job.simpleplugins package

Submodules

class aiida.orm.calculation.job.simpleplugins.templatereplacer.TemplatereplacerCalculation(**kwargs)[source]

Bases: aiida.orm.implementation.django.calculation.job.JobCalculation

Simple stub of a plugin that can be used to replace some text in a given template. Can be used for many different codes, or as a starting point to develop a new plugin.

This simple plugin takes two node inputs, both of type ParameterData, with the labels ‘parameters’ and ‘template’

You can also add other SinglefileData nodes as input, that will be copied according to what is written in ‘template’ (see below).

  • parameters: a set of parameters that will be used for substitution.

  • template: can contain the following parameters:

    • input_file_template: a string with substitutions to be managed with the format() function of python, i.e. if you want to substitute a variable called ‘varname’, you write {varname} in the text. See http://www.python.org/dev/peps/pep-3101/ for more details. The replaced file will be the input file.
    • input_file_name: a string with the file name for the input. If it is not provided, no file will be created.
    • output_file_name: a string with the file name for the output. If it is not provided, no redirection will be done and the output will go in the scheduler output file.
    • cmdline_params: a list of strings, to be passed as command line parameters. Each one is substituted with the same rule of input_file_template. Optional
    • input_through_stdin: if True, the input file name is passed via stdin. Default is False if missing.
    • files_to_copy: if defined, a list of tuple pairs, with format (‘link_name’, ‘dest_rel_path’);
      for each tuple, an input link to this calculation is looked for, with link labeled ‘link_label’, and with file type ‘Singlefile’, and the content is copied to a remote file named ‘dest_rel_path’ Errors are raised in the input links are non-existent, or of the wrong type, or if there are unused input files.
    • retrieve_temporary_files: a list of relative filepaths, that if defined, will be retrieved and
      temporarily stored in an unstored FolderData node that will be available during the Parser.parser_with_retrieved call under the key specified by the Parser.retrieved_temporary_folder key

TODO: probably use Python’s Template strings instead?? TODO: catch exceptions TODO: write a ‘input_type_checker’ routine to automatically check the existence and type of inputs + default values etc.

__abstractmethods__ = frozenset([])
__module__ = 'aiida.orm.calculation.job.simpleplugins.templatereplacer'
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 94
_abc_registry = <_weakrefset.WeakSet object>
_logger = <celery.utils.log.ProcessAwareLogger object>
_plugin_type_string = 'calculation.job.simpleplugins.templatereplacer.TemplatereplacerCalculation.'
_prepare_for_submission(tempfolder, inputdict)[source]

This is the routine to be called when you want to create the input files and related stuff with a plugin.

Parameters:
  • tempfolder – a aiida.common.folders.Folder subclass where the plugin should put all its files.
  • inputdict – a dictionary with the input nodes, as they would be returned by get_inputs_dict (with the Code!)
_query_type_string = 'calculation.job.simpleplugins.templatereplacer.'
_use_methods = {'code': {'linkname': 'code', 'additional_parameter': None, 'docstring': 'Choose the code to use', 'valid_types': <class 'aiida.orm.implementation.django.code.Code'>}, 'parameters': {'linkname': 'parameters', 'additional_parameter': None, 'docstring': 'Parameters used to replace placeholders in the template', 'valid_types': <class 'aiida.orm.data.parameter.ParameterData'>}, 'template': {'linkname': 'template', 'additional_parameter': None, 'docstring': 'A template for the input file', 'valid_types': <class 'aiida.orm.data.parameter.ParameterData'>}}