Creates a new task that will execute the provided command. :param args: List of arguments will be executed. The arguments have to be strings. :param env: Environment variables passed to the executed command. :param cwd: Working directory of the executed command.
(
self,
args: ProgramArgs,
*,
env: Optional[EnvType] = None,
cwd: Optional[GenericPath] = None,
stdout: Optional[Stdio] = default_stdout(),
stderr: Optional[Stdio] = default_stderr(),
stdin: Optional[Union[str, bytes]] = None,
deps: Sequence[Task] = (),
name: Optional[str] = None,
task_dir: bool = False,
priority: int = 0,
resources: Optional[Union[ResourceRequest, Sequence[ResourceRequest]]] = None,
crash_limit: Optional[int] = None,
)
| 44 | return self.task_map.get(id) |
| 45 | |
| 46 | def program( |
| 47 | self, |
| 48 | args: ProgramArgs, |
| 49 | *, |
| 50 | env: Optional[EnvType] = None, |
| 51 | cwd: Optional[GenericPath] = None, |
| 52 | stdout: Optional[Stdio] = default_stdout(), |
| 53 | stderr: Optional[Stdio] = default_stderr(), |
| 54 | stdin: Optional[Union[str, bytes]] = None, |
| 55 | deps: Sequence[Task] = (), |
| 56 | name: Optional[str] = None, |
| 57 | task_dir: bool = False, |
| 58 | priority: int = 0, |
| 59 | resources: Optional[Union[ResourceRequest, Sequence[ResourceRequest]]] = None, |
| 60 | crash_limit: Optional[int] = None, |
| 61 | ) -> ExternalProgram: |
| 62 | """ |
| 63 | Creates a new task that will execute the provided command. |
| 64 | |
| 65 | :param args: List of arguments will be executed. The arguments have to be strings. |
| 66 | :param env: Environment variables passed to the executed command. |
| 67 | :param cwd: Working directory of the executed command. |
| 68 | :param stdout: Path to a file that will store the standard output of the executed command. |
| 69 | :param stderr: Path to a file that will store the standard error output of the executed |
| 70 | command. |
| 71 | :param stdin: If provided, these bytes will be passed as the standard input of the executed |
| 72 | command. |
| 73 | :param deps: A sequence of dependencies that have to be completed first before this task |
| 74 | can start executing. |
| 75 | :param name: Name of the task. |
| 76 | :param task_dir: If True, an isolated directory will be created for the task. |
| 77 | :param priority: Priority of the created task. |
| 78 | :param resources: List of resource requests required by this task. |
| 79 | :param crash_limit: How many times can a worker that executes this task crash before the |
| 80 | task is considered to be failed. |
| 81 | """ |
| 82 | task = ExternalProgram( |
| 83 | len(self.tasks), |
| 84 | args=args, |
| 85 | env=merge_envs(self.default_env, env), |
| 86 | cwd=cwd or self.default_workdir, |
| 87 | dependencies=deps, |
| 88 | stdout=stdout, |
| 89 | stderr=stderr, |
| 90 | stdin=stdin, |
| 91 | name=name, |
| 92 | task_dir=task_dir, |
| 93 | priority=priority, |
| 94 | resources=resources, |
| 95 | crash_limit=crash_limit, |
| 96 | ) |
| 97 | self._add_task(task) |
| 98 | return task |
| 99 | |
| 100 | def function( |
| 101 | self, |