Source code hyperqueue/ffi/protocol.py

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import dataclasses
from typing import Dict, List, Optional, Sequence


@dataclasses.dataclass()
class ResourceRequest:
    n_nodes: int = 0
    cpus: str = "1"
    generic: Dict[str, int] = dataclasses.field(default_factory=dict)


@dataclasses.dataclass()
class TaskDescription:
    id: int
    args: List[str]
    cwd: Optional[str]
    stdout: Optional[str]
    stderr: Optional[str]
    stdin: Optional[bytes]
    env: Optional[Dict[str, str]]
    dependencies: Sequence[int]
    task_dir: bool
    priority: int
    resource_request: Optional[ResourceRequest]


@dataclasses.dataclass
class JobDescription:
    tasks: List[TaskDescription]
    max_fails: Optional[int]