MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / ExternalProgram

Class ExternalProgram

crates/pyhq/python/hyperqueue/task/program.py:13–84  ·  view source on GitHub ↗

Task that represents the execution of an executable binary.

Source from the content-addressed store, hash-verified

11
12
13class ExternalProgram(Task):
14 """
15 Task that represents the execution of an executable binary.
16 """
17
18 def __init__(
19 self,
20 task_id: TaskId,
21 *,
22 args: List[str],
23 env: Optional[EnvType] = None,
24 cwd: Optional[GenericPath] = None,
25 stdout: Optional[Stdio] = None,
26 stderr: Optional[Stdio] = None,
27 stdin: Optional[Union[str, bytes]] = None,
28 name: Optional[str] = None,
29 dependencies: Sequence[Task] = (),
30 task_dir: bool = False,
31 priority: int = 0,
32 resources: Optional[ResourceRequest],
33 crash_limit: Optional[int] = None,
34 ):
35 super().__init__(
36 task_id,
37 dependencies,
38 priority,
39 resources,
40 env=env,
41 cwd=cwd,
42 stdout=stdout,
43 stderr=stderr,
44 name=name,
45 crash_limit=crash_limit,
46 )
47 args = to_arg_list(args)
48 validate_args(args)
49 self.args = args
50 self.task_dir = task_dir
51
52 if stdin is None or isinstance(stdin, bytes):
53 self.stdin = stdin
54 elif isinstance(stdin, str):
55 self.stdin = stdin.encode()
56 else:
57 raise Exception("stdin has to be str, bytes, or None")
58
59 self.outputs = get_task_outputs(self)
60
61 def _build(self, client):
62 depends_on = [dependency.task_id for dependency in self.dependencies]
63 return TaskDescription(
64 id=self.task_id,
65 args=self.args,
66 env=self.env,
67 stdout=self.stdout,
68 stderr=self.stderr,
69 stdin=self.stdin,
70 cwd=self.cwd,

Callers 5

submit_computationFunction · 0.85
build_task_descriptionFunction · 0.85
task_descFunction · 0.85
programMethod · 0.85
build_task_descFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected