launch
Common utilities for LUTE launch scripts.
EnvLaunchInfo
Bases: TypedDict
Subset of workflow info retrievable via eLog or environment variables.
Source code in lute/execution/launch.py
42 43 44 45 46 47 48 49 | |
LuteLaunchConfig
Bases: TypedDict
Complete description of config options required for workflow execution.
Source code in lute/execution/launch.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | |
get_base_launch_parser(description)
Create a base ArgumentParser with common arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
description
|
str
|
A string to go in the help message for the launch script that will be built with the parser. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
parser |
ArgumentParser
|
The script command-line parser. |
Source code in lute/execution/launch.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
get_concurrent_job_steps(wf)
Return the maximum number of concurrent JobSteps.
This can be used to determine how many threads to add to the threadpool for the workflow manager.
NOTE: This is a very basic calculation - if you have complicated branch structures it may undershoot the number of concurrent jobs. For safety you can add one to the returned value - this will likely cover 99% of all workflow cases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wf
|
List[Any]
|
The workflow (list of JobSteps). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
max_concurrent_jobs |
int
|
The maximum number of jobs found to run in parallel at any given time. |
Source code in lute/execution/launch.py
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 | |
get_lute_launch_config(launch_info, run_type, is_daq2, lute_params, slurm_params, workflow_defn={}, lute_location=None, executable_subdir=None)
Construct the standardized LUTE launch configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
launch_info
|
EnvLaunchInfo
|
The set of launch information retrievable from
command-line arguments or environment variables. See |
required |
run_type
|
str
|
The run type. |
required |
is_daq2
|
Optional[bool]
|
Whether it is an LCLS1 or LCLS2 experiment. |
required |
lute_params
|
LuteParams
|
The config file and debug options for LUTE. |
required |
slurm_params
|
List[str]
|
The list of SLURM parameters (if any). |
required |
workflow_defn
|
Dict[str, Any]
|
The parsed workflow definition. Empty dict if not using YAML DAGs. |
{}
|
lute_location
|
Optional[str]
|
The path to the LUTE installation. If not provided, it is assumed to be the parent directory of the current working directory. |
None
|
executable_subdir
|
Optional[str]
|
The subdirectory where the launch executable is located. If not provided, it is assumed to be the basename of the current working directory. |
None
|
Source code in lute/execution/launch.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
request_arp_token(exp, lifetime=300)
Request an ARP token via Kerberos endpoint.
A token is required for job submission.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
exp
|
str
|
The experiment to request the token for. All tokens are scoped to a single experiment. |
required |
lifetime
|
int
|
The lifetime, in minutes, of the token. After the token expires, it can no longer be used for job submission. The maximum time you can request is 480 minutes (i.e. 8 hours). NOTE: since this token is used for the entirety of a workflow, it must have a lifetime equal or longer than the duration of the workflow's execution time. |
300
|
Returns:
| Name | Type | Description |
|---|---|---|
formatted_token |
str
|
The formated ARP token. |
Source code in lute/execution/launch.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
retrieve_run_info(experiment, run_num, authorization, override_type='')
Retrieve run type and DAQ version from eLog API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiment
|
str
|
The experiment. |
required |
run_num
|
str
|
The run number. |
required |
authorization
|
str
|
The JWT token for making the API requests to get run documents from the eLog. |
required |
override_type
|
str
|
An optional override type to use instead of the actual run type. (This is only used to maintain the structure of older launch scripts.) |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
run_type |
str
|
The run type (potentially overriden by override_type). |
is_daq2 |
Optional[bool]
|
Whether this is an LCLS1 or LCLS2 experiment if it could be determined. |
Source code in lute/execution/launch.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | |
setup_launch_env(args)
Setup experiment, run, and authorization information.
Checks environment variables first (ARP submission), then falls back to arguments and manual token request.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args
|
Namespace
|
The arguments parsed via command-line. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
env_cmd_vars |
EnvLaunchInfo
|
A dictionary of variables which will be passed either via environment or command-line to the job submission scripts (submit_slurm) during workflow execution. |
Source code in lute/execution/launch.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |