50 lines
6.9 KiB
Python
50 lines
6.9 KiB
Python
import logging
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def task_instance_mutation_hook(ti):
|
|
|
|
|
|
|
|
if ti.dag_id == 'ytdlp_ops_worker_per_url':
|
|
|
|
|
|
|
|
worker_queue = ti.dag_run.conf.get('worker_queue')
|
|
|
|
|
|
|
|
if worker_queue:
|
|
|
|
|
|
|
|
logger.info(f"Mutating queue for task {ti.task_id} to {worker_queue} based on dag_run.conf")
|
|
|
|
|
|
|
|
ti.queue = worker_queue
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
logger.warning(f"No worker_queue in conf for {ti.dag_id}. Falling back to 'queue-dl'")
|
|
|
|
|
|
|
|
ti.queue = 'queue-dl'
|