Skip to content

Commit

Permalink
launch_shell_job: Move arguments as the second argument
Browse files Browse the repository at this point in the history
When invoking `launch_shell_job` with positional arguments only, in most
cases users will naturally want to place the `arguments` input as the
second positional argument:

    launch_shell_job('some_command', '-p with -f arguments')

Currently, for these simple cases, the user is forced to use the keyword
argument notation since `arguments` does not come as second. This is
changed such that the most common case can be written as tersely as
possible.
  • Loading branch information
Sebastiaan Huber authored and sphuber committed Nov 1, 2023
1 parent 2f4fb3d commit 8957f59
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/aiida_shell/engine/launchers/shell_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

def launch_shell_job( # pylint: disable=too-many-arguments
command: str | AbstractCode,
arguments: list[str] | str | None = None,
nodes: t.Mapping[str, str | pathlib.Path | Data] | None = None,
filenames: dict[str, str] | None = None,
arguments: list[str] | str | None = None,
outputs: list[str] | None = None,
parser: t.Callable[[Parser, pathlib.Path], dict[str, Data]] | str | None = None,
metadata: dict[str, t.Any] | None = None,
Expand All @@ -35,11 +35,11 @@ def launch_shell_job( # pylint: disable=too-many-arguments
:param command: The shell command to run. Should be the relative command name, e.g., ``date``. An ``AbstractCode``
instance will be automatically created for this command if it doesn't already exist. Alternatively, a pre-
configured ``AbstractCode`` instance can be passed directly.
:param nodes: A dictionary of ``Data`` nodes whose content is to replace placeholders in the ``arguments`` list.
:param filenames: Optional dictionary of explicit filenames to use for the ``nodes`` to be written to ``dirpath``.
:param arguments: Optional list of command line arguments optionally containing placeholders for input nodes. The
arguments can also be specified as a single string. In this case, it will be split into separate parameters
using ``shlex.split``.
:param nodes: A dictionary of ``Data`` nodes whose content is to replace placeholders in the ``arguments`` list.
:param filenames: Optional dictionary of explicit filenames to use for the ``nodes`` to be written to ``dirpath``.
:param outputs: Optional list of relative filenames that should be captured as outputs.
:param parser: Optional callable that can implement custom parsing logic of produced output files. Alternatively,
a complete entry point, i.e. a string of the form ``{entry_point_group}:{entry_point_name}`` pointing to such a
Expand Down

0 comments on commit 8957f59

Please sign in to comment.