Skip to content

Commit ace0759

Browse files
committed
Fix script meta docs
1 parent 6ff299e commit ace0759

File tree

3 files changed

+69
-6
lines changed

3 files changed

+69
-6
lines changed

docs/targets/script/execution-flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MLC Script Execution
1+
# Script Execution
22

33
## Understanding MLC scripts
44

docs/targets/script/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ mlc run script --tags=detect,os -j
145145
```
146146

147147
**Options:**
148+
148149
- `-j`: Shows the output in a JSON format
149150

150151
- `mlcr` can be used as a shortcut to `mlc run script --tags=`
@@ -175,6 +176,7 @@ mlc run script --tags=detect,os -j
175176

176177
<details>
177178
<summary><strong>Example Output</strong> 📌</summary>
179+
```
178180
arjun@arjun-spr:~$ mlcr detect,os -j
179181
[2025-02-16 03:30:40,702 module.py:560 INFO] - * mlcr detect,os
180182
[2025-02-16 03:30:40,704 module.py:5334 INFO] - ! cd /home/arjun
@@ -252,6 +254,7 @@ arjun@arjun-spr:~$ mlcr detect,os -j
252254
},
253255
"deps": []
254256
}
257+
```
255258

256259
</details>
257260
---

docs/targets/script/meta.md

Lines changed: 65 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,175 @@
1-
# MLC Script Meta
1+
# Script Meta
22

33
This page provides a walkthrough of the `meta.yaml` file.
44

55
## Important Keys and Data Types
66

77
- **alias** (`string`)
8+
89
- Alias of the script, which can be used instead of tags when running a script.
910

1011
- **uid** (`string`)
12+
1113
- Unique identifier for individual scripts.
14+
1215
- Can be used instead of tags when running a script.
1316

1417
- **automation_alias** (`string`)
18+
1519
- Alias specific to script automation.
1620

1721
- **automation_uid** (`string`)
22+
1823
- Unique identifier for script automation.
1924

2025
- **category** (`string`)
26+
2127
- Defines the script category.
2228

2329
- **tags** (`list of strings`)
30+
2431
- List of tags users can specify to run the script.
2532

2633
- **default_env** (`dictionary` with `string` values)
27-
- Contains key-value pairs representing environment variables and their default values for a script.
34+
35+
- Contains key-value pairs representing environment variables and their default values for a script.
36+
2837
- These default values are overridden if the same environment variable is set in script files or inherited from a parent script.
2938

3039
- **env** (`dictionary` with `string` values)
40+
3141
- Defines environment variables and their corresponding values.
3242

3343
- **input_mapping** (`dictionary` with `string` values)
44+
3445
- Maps input flags related to a script to corresponding environment variables.
46+
3547
- Only keys specified under `input_mapping` in `meta.yaml` are mapped to environment variables.
3648

3749
- **env_key_mapping** (`dictionary` with `string` values)
50+
3851
- Maps one environment key to another.
3952

4053
- **new_env_keys** (`list of strings`)
54+
4155
- Specifies environment keys that should be passed to a parent script if this script is used as a dependency.
4256

4357
- **new_state_keys** (`list of strings`)
58+
4459
- Specifies state keys that should be passed to a parent script when used as a dependency.
4560

4661
- **add_deps_recursive** (`dictionary`)
62+
4763
- Customizes recursive dependencies with nested `tags` and other attributes.
4864

4965
### Dependencies
5066

5167
Dependencies in a script are specified as a list of dictionaries.
68+
5269
- Each dictionary can contain:
70+
5371
- **tags**
72+
5473
- Comma separated list of tags to identify a dependent script
74+
5575
- **names** (`list of strings`)
76+
5677
- Identifiers for dependencies, allowing users to modify the deps executions when needed.
78+
5779
- **enable_if_env** (`dictionary` with `list of strings` values)
80+
5881
- Specifies conditions under which a dependency is enabled based on environment variables. The conditions are ANDed.
82+
5983
- **enable_if_any_env** (`dictionary` with `list of strings` values)
84+
6085
- Specifies conditions under which a dependency is enabled based on environment variables. The conditions are ORed.
86+
6187
- **skip_if_env** (`dictionary` with `list of strings` values)
88+
6289
- Specifies conditions under which a dependency should be skipped. The conditions are ANDed.
90+
6391
- **skip_if_any_env** (`dictionary` with `list of strings` values)
92+
6493
- Specifies conditions under which a dependency should be skipped. The conditions are ORed.
94+
6595
- Any other script meta can also be included which will be passed to the dependent script
6696

6797
In MLC script, there are four types of dependencies.
98+
6899
- **deps**
100+
69101
- Executes after processing the script meta, but before the `preprocess` function
102+
70103
- **prehook_deps**
104+
71105
- Executes after the `preprocess` function, but before the `run` script
106+
72107
- **posthook_deps**
108+
73109
- Executes after the `run` script, but before the `postprocess` function
110+
74111
- **post_deps**
112+
75113
- Executes after the `postprocess` function
76-
- More details on script execution flow can be found [here](execution-flow.md).
114+
115+
More details on script execution flow can be found [here](execution-flow.md).
77116

78117

79118
### Variation Configuration
80119

81120
- **variations** (`dictionary`)
121+
82122
- Contains script variations, including attributes like `alias`, `default_variations`, and `group`.
83123

84124
- **group** (`string`)
125+
85126
- Specifies the script variation group. Maximum one variation from a given group can be selected during a script invocation and if `default:true` is set for a variation in a group, that variation is turned on unless another variation is specified during the script invocation.
86127

87128
- **default_variations** (`dictionary` with `string` values)
129+
88130
- Specifies default variations for the script.
89131

90132

91133

92134
### Docker Configuration
93135

94136
- **docker** (`dictionary`)
137+
95138
- Contains Docker-specific configurations:
139+
96140
- **base_image** (`string`) – Base Docker image
141+
97142
- **image_name** (`string`) – Docker image name
143+
98144
- **os** (`string`) – Operating system
145+
99146
- **os_version** (`string`) – OS version
147+
100148
- **deps** (`list of dictionaries`) – Specifies dependencies required in Docker
149+
101150
- **env** (`dictionary` with `string` values) – Defines environment variables inside the container
151+
102152
- **interactive** (`boolean`) – Indicates if the container should be interactive
153+
103154
- **extra_run_args** (`string`) – Additional arguments for `docker run`
155+
104156
- **mounts** (`list of strings`) – Specifies mount paths in the format `"source:destination"`
157+
105158
- **pre_run_cmds** (`list of strings`) – Commands to execute before starting the container
159+
106160
- **docker_input_mapping** (`dictionary` with `string` values) – Maps input parameters to Docker environment variables
161+
107162
- **use_host_user_id** (`boolean`) – Uses the host's user ID inside the container
163+
108164
- **use_host_group_id** (`boolean`) – Uses the host's group ID inside the container
165+
109166
- **skip_run_cmd** (`string`) – Command to skip execution
167+
110168
- **shm_size** (`string`) – Defines shared memory size
111-
- **real_run** (`boolean`) – Indicates if the container run should be real
112-
- **all_gpus** (`string`) – Specifies GPU availability
169+
170+
- **real_run** (`boolean`) – Indicates if the container should do the MLC script run at end, if not only the deps will be run
171+
172+
- **all_gpus** (`string`) – Use all available GPUs
113173

114174
---
115175

0 commit comments

Comments
 (0)