Beispiel #1
0
 def _transport_type_validator(cls, transport_type):
     """
     Validates the transport string.
     """
     if transport_type not in Transport.get_valid_transports():
         raise ValidationError("The specified transport is not a valid one")
Beispiel #2
0
    def _conf_attributes(self):
        """
        Return the configuration attributes to be used in the 'setup' phase.

        The return value is a list of tuples. Each tuple has three elements:
        1. an internal name (used to find the
           _set_internalname_string, and get_internalname_string methods)
        2. a short human-readable name
        3. A long human-readable description
        4. True if it is a multi-line input, False otherwise

        For the implementation, see in aiida.cmdline.computer

        .. note: you can define a ``_shouldcall_internalname`` method that returns
          either True or False if the specific configuration option has to be
          called or not. If such a method is not found, the option is always
          asked to the user. In this case, you typically also want to define a
          ``_cleanup_internalname`` method to remove any previous configuration
          associated to internalname, in case ``_shouldcall_internalname``
          returns False.

        .. note: IMPORTANT! For each entry, remember to define the
          ``_set_internalname_string`` and ``get_internalname_string`` methods.
          Moreover, the ``_set_internalname_string`` method should also
          immediately validate the value.

        ..note: Defining it as a property increases the overall execution
          of the code because it does not require to calculate
          Transport.get_valid_transports() at each load of this class.
        """

        return [
            ("hostname",
             "Fully-qualified hostname",
             "The fully qualified host-name of this computer",
             False,
             ),
            ("description",
             "Description",
             "A human-readable description of this computer",
             False,
             ),
            ("enabled_state",
             "Enabled",
             "True or False; if False, the computer is disabled and calculations\n"
             "associated with it will not be submitted",
             False,
             ),
            ("transport_type",
             "Transport type",
             "The name of the transport to be used. Valid names are: {}".format(
                 ",".join(Transport.get_valid_transports())),
             False,
             ),
            ("scheduler_type",
             "Scheduler type",
             "The name of the scheduler to be used. Valid names are: {}".format(
                 ",".join(Scheduler.get_valid_schedulers())),
             False,
             ),
            ("shebang",
             "shebang line at the beginning of the submission script",
             "this line specifies the first line of the submission script for this computer",
             False,
             ),
            ("workdir",
             "AiiDA work directory",
             "The absolute path of the directory on the computer where AiiDA will\n"
             "run the calculations (typically, the scratch of the computer). You\n"
             "can use the {username} replacement, that will be replaced by your\n"
             "username on the remote computer",
             False,
             ),
            # Must be called after the scheduler!
            ("mpirun_command",
             "mpirun command",
             "The mpirun command needed on the cluster to run parallel MPI\n"
             "programs. You can use the {tot_num_mpiprocs} replacement, that will be \n"
             "replaced by the total number of cpus, or the other scheduler-dependent\n"
             "replacement fields (see the scheduler docs for more information)",
             False,
             ),
            ("default_mpiprocs_per_machine",
             "Default number of CPUs per machine",
             "Enter here the default number of CPUs per machine (node) that \n"
             "should be used if nothing is otherwise specified. Leave empty \n"
             "if you do not want to provide a default value.\n",
             False,
             ),
            ("prepend_text",
             "Text to prepend to each command execution",
             "This is a multiline string, whose content will be prepended inside\n"
             "the submission script before the real execution of the job. It is\n"
             "your responsibility to write proper bash code!",
             True,
             ),
            ("append_text",
             "Text to append to each command execution",
             "This is a multiline string, whose content will be appended inside\n"
             "the submission script after the real execution of the job. It is\n"
             "your responsibility to write proper bash code!",
             True,
             ),
        ]