|
27 | 27 |
|
28 | 28 |
|
29 | 29 | #: Schema for run.using run_task |
30 | | -class RunTaskRunSchema(Schema, forbid_unknown_fields=False, kw_only=True): |
31 | | - # Specifies the task type. Must be 'run-task'. |
32 | | - using: Literal["run-task"] |
33 | | - # The command arguments to pass to the `run-task` script, after the checkout |
34 | | - # arguments. If a list, it will be passed directly; otherwise it will be |
35 | | - # included in a single argument to the command specified by `exec-with`. |
36 | | - command: Union[list[taskref_or_string_msgspec], taskref_or_string_msgspec] |
37 | | - # If true (the default), perform a checkout on the worker. Can also be a |
38 | | - # dictionary specifying explicit checkouts. |
39 | | - checkout: Union[bool, dict[str, dict]] |
40 | | - # Base work directory used to set up the task. |
41 | | - workdir: str |
42 | | - # Specifies which caches to use. May take a boolean in which case either all |
43 | | - # (True) or no (False) caches will be used. Alternatively, it can accept a |
44 | | - # list of caches to enable. Defaults to only the checkout cache enabled. |
45 | | - use_caches: Optional[Union[bool, list[CacheType]]] = None |
46 | | - # Path to run command in. If a checkout is present, the path to the checkout |
47 | | - # will be interpolated with the key `checkout`. |
48 | | - cwd: Optional[str] = None |
49 | | - # Specifies what to execute the command with in the event the command is a |
50 | | - # string. |
51 | | - exec_with: Optional[ExecWith] = None |
52 | | - # Command used to invoke the `run-task` script. Can be used if the script |
53 | | - # or Python installation is in a non-standard location on the workers. |
54 | | - run_task_command: Optional[list] = None |
55 | | - # Whether to run as root. Defaults to False. |
56 | | - run_as_root: Optional[bool] = None |
57 | | - |
58 | | - |
59 | | -run_task_schema = RunTaskRunSchema |
| 30 | +run_task_schema = Schema.from_dict( |
| 31 | + { |
| 32 | + # Specifies the task type. Must be 'run-task'. |
| 33 | + "using": Literal["run-task"], |
| 34 | + # The command arguments to pass to the `run-task` script, after the checkout |
| 35 | + # arguments. If a list, it will be passed directly; otherwise it will be |
| 36 | + # included in a single argument to the command specified by `exec-with`. |
| 37 | + "command": Union[list[taskref_or_string_msgspec], taskref_or_string_msgspec], |
| 38 | + # If true (the default), perform a checkout on the worker. Can also be a |
| 39 | + # dictionary specifying explicit checkouts. |
| 40 | + "checkout": Union[bool, dict[str, dict]], |
| 41 | + # Base work directory used to set up the task. |
| 42 | + "workdir": str, |
| 43 | + # Specifies which caches to use. May take a boolean in which case either all |
| 44 | + # (True) or no (False) caches will be used. Alternatively, it can accept a |
| 45 | + # list of caches to enable. Defaults to only the checkout cache enabled. |
| 46 | + "use-caches": Optional[Union[bool, list[CacheType]]], |
| 47 | + # Path to run command in. If a checkout is present, the path to the checkout |
| 48 | + # will be interpolated with the key `checkout`. |
| 49 | + "cwd": Optional[str], |
| 50 | + # Specifies what to execute the command with in the event the command is a |
| 51 | + # string. |
| 52 | + "exec-with": Optional[ExecWith], |
| 53 | + # Command used to invoke the `run-task` script. Can be used if the script |
| 54 | + # or Python installation is in a non-standard location on the workers. |
| 55 | + "run-task-command": Optional[list], |
| 56 | + # Whether to run as root. Defaults to False. |
| 57 | + "run-as-root": Optional[bool], |
| 58 | + }, |
| 59 | + name="RunTaskRunSchema", |
| 60 | + forbid_unknown_fields=False, |
| 61 | +) |
60 | 62 |
|
61 | 63 |
|
62 | 64 | def common_setup(config, task, taskdesc, command): |
|
0 commit comments