-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
28 lines (20 loc) · 900 Bytes
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import asyncio
import logging
from orca.services.nextflowtower import NextflowTowerOps
logger = logging.getLogger(__name__)
async def monitor_run(ops: NextflowTowerOps, run_id: str):
"""Wait until workflow run completes."""
workflow = ops.get_workflow(run_id)
wf_repr = f"{workflow.run_name} ({run_id})"
logger.info(f"Starting to monitor workflow: {wf_repr}")
status, is_done = ops.get_workflow_status(run_id)
while not is_done:
logger.info(f"{wf_repr} not done yet ({status.value}). Checking again in 5 min...")
await asyncio.sleep(60 * 5)
status, is_done = ops.get_workflow_status(run_id)
logger.info(f"{wf_repr} is done! Final status is '{status.value}'.")
return status
def configure_logging():
"""Configure logging for Orca and Airflow."""
# Silence Airflow logging
logging.getLogger("airflow").setLevel(logging.ERROR)