lstautorta.Auto_RTA
Automatically start/stop RTA reconstruction pipeline for new runs during a observation night.
New runs are found querying the TCU pymongo database regularly. This script: - copies the conda environment and reconstruction model to the RAM of the slurm nodes - queries the TCU pymongo database for new runs regularly and for each new run: - stops the r0->dl1 daemons for the previous runs - starts the r0->dl1 daemons for the new run, using a static configuration (CDB configuration) from disk, and writing the dynamic configuration to disk as well. - starts the "engineering gui" scripts allowing to monitor data processing for the run. - stops at a fixed hour according to its configuration file - cleans the RAM of slurm worker nodes
Classes:
| Name | Description |
|---|---|
ConnectionJobInfo |
Store a slurm computing daemon's information. |
Functions:
| Name | Description |
|---|---|
assign_worker_to_data_connection |
Assign a worker node from |
main |
Entrypoint of Auto_RTA. |
nuke_rta |
Hard stop of All RTA jobs: scancels all jobs of |
scancel_jobs |
Run |
srun_cmd_worker_nodes |
Submit a slurm command with srun on all worker nodes in |
stop_rta |
Stop the r0dl1 daemons. |
write_reco_manager_observation_config |
Write the observation configuration for the reco-manager. |
ConnectionJobInfo
Bases: NamedTuple
flowchart TD
lstautorta.Auto_RTA.ConnectionJobInfo[ConnectionJobInfo]
click lstautorta.Auto_RTA.ConnectionJobInfo href "" "lstautorta.Auto_RTA.ConnectionJobInfo"
Store a slurm computing daemon's information.
Source code in src/lstautorta/Auto_RTA.py
assign_worker_to_data_connection
Assign a worker node from slurm_nodes to each data server connection in tel_ids_to_data_servers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slurm_nodes
|
Dict[str, List[str]]
|
Mapping from slurm reservation to slurm nodes, see AutoRTAConfiguration.slurm_nodes field. |
required |
tel_ids_to_data_servers
|
Dict[Annotated[int, Gt(0)], List[DataStreamConnectionConfiguration]]
|
Mapping from telescope ID to data servers connections, see AutoRTAConfiguration.tel_ids_to_data_servers |
required |
Returns:
| Type | Description |
|---|---|
Dict[Tuple[int, str, str], Tuple[str, str]]
|
Map from (tel_id, hostname, port) to (slurm_reservation, slurm_nodename) |
Source code in src/lstautorta/Auto_RTA.py
main
Entrypoint of Auto_RTA.
- parse the available slurm nodes
- check that the slurm nodes are in "connected" network mode
- copy conda environment to slurm nodes (usually in /dev/shm/ (RAM))
- query database for current RUN and for each run:
- stops previous RTA reconstruction slurm jobs
- starts new R0-DL1 jobs for the new RUN with static configuration (CDB config) and a newly written dynamic config
- starts engineering GUI plotting scripts
- stops at a fixed hour set in configuration, after cleaning slurm nodes memory.
Source code in src/lstautorta/Auto_RTA.py
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 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 | |
nuke_rta
Hard stop of All RTA jobs: scancels all jobs of slurm_account.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slurm_account
|
str
|
slurm account |
required |
Source code in src/lstautorta/Auto_RTA.py
scancel_jobs
Run scancel onjob_ids, sendingsignalafterdelay_s` seconds.
Use the --quiet argument of scancel to not raise error if the jobs are already stopped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_ids
|
List[str]
|
List of job ids to scancel |
required |
signal
|
Signals
|
Signal to send with scancel |
required |
delay_s
|
float | None
|
Amount of time in second to wait before performing the scancel |
None
|
ignore_error
|
bool
|
If True, the scancel is run directly with subprocess.srun, and any error happening in the subprocess is simply ignored. This is usefull when running scancel -s KILL after a scancel -s INT: if the SIGINT stopped the job already, the SIGKILL would have exit code 1 even with --quiet, but we want to ignore the error in this case. |
False
|
Source code in src/lstautorta/Auto_RTA.py
srun_cmd_worker_nodes
srun_cmd_worker_nodes(connection_jobs_info, cmd, additional_slurm_params=None, error_level=LOGGING_LEVELS_DICT['CRITICAL'])
Submit a slurm command with srun on all worker nodes in connection_jobs_info.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
connection_jobs_info
|
List[ConnectionJobInfo]
|
List of connection job information: |
required |
cmd
|
str
|
Command to run with srun. |
required |
additional_slurm_params
|
List[str] or None
|
List of additional slurm jobs parameters, separated between args and values, for instance ["--mem", "20G"] Optionnal, default is None. |
None
|
Returns:
| Type | Description |
|---|---|
List[CompletedProcess]
|
List of completed processes. |
Source code in src/lstautorta/Auto_RTA.py
stop_rta
Stop the r0dl1 daemons.
The r0dl1 jobs are immediately send a SIGINT signal, which should tell them to gracefully shut down. A SIGKILL is also scheduled to run 10 seconds later to ensure the jobs are indeed stopped.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
slurm_reservations
|
List[str]
|
List of slurm reservation to search for r0dl1 daemons. |
required |
slurm_account
|
str
|
Slurm account to use when searching for the r0dl1 daemons. |
required |
r0dl1_job_name
|
str
|
Name of the r0dl1 jobs in the CDB configuration |
required |
Returns:
| Name | Type | Description |
|---|---|---|
stop_thread |
Thread | None
|
Started thread that will SIGKILL the r0dl1 jobs after 10 secs. None if there were no jobs to stop. |
Source code in src/lstautorta/Auto_RTA.py
write_reco_manager_observation_config
write_reco_manager_observation_config(obs_info, obs_dir, night_path_structure, auto_rta_config, output_path)
Write the observation configuration for the reco-manager.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obs_info
|
ObsInfo
|
Observation parameters from observation DB |
required |
obs_dir
|
Path
|
Path to the observation data directory |
required |
night_path_structure
|
RecoPathStructure
|
Path structure of the night |
required |
auto_rta_config
|
AutoRTAConfiguration
|
Configuration of Auto RTA |
required |
output_path
|
Path
|
Path where to write the hiperta_stream_start configuration |
required |