Reads the task's PID from its stdout.
(hq_env: HqEnv, job_id: int = 1)
| 33 | |
| 34 | |
| 35 | def read_task_pid(hq_env: HqEnv, job_id: int = 1) -> int: |
| 36 | """ |
| 37 | Reads the task's PID from its stdout. |
| 38 | """ |
| 39 | wait_for_job_state(hq_env, job_id, "RUNNING") |
| 40 | |
| 41 | def get_pid(): |
| 42 | pid = read_file(default_task_output(job_id=job_id)).strip() |
| 43 | if not pid: |
| 44 | return None |
| 45 | return int(pid) |
| 46 | |
| 47 | return wait_until(get_pid) |