ashb commented on a change in pull request #6340: [AIRFLOW-5660] Attempt to
find the task in DB from Kubernetes pod labels
URL: https://github.com/apache/airflow/pull/6340#discussion_r356030450
##########
File path: airflow/executors/kubernetes_executor.py
##########
@@ -545,6 +545,27 @@ def _labels_to_key(self, labels):
return None
with create_session() as session:
+ task = (
+ session
+ .query(TaskInstance)
+ .filter_by(task_id=task_id, dag_id=dag_id,
execution_date=ex_time)
+ .one_or_none()
+ )
+ if task:
+ self.log.info(
+ 'Found matching task %s-%s (%s) with current state of %s',
+ task.dag_id, task.task_id, task.execution_date, task.state
+ )
+ return (dag_id, task_id, ex_time, try_num)
+ else:
+ self.log.warning(
+ 'task_id/dag_id are not safe to use as Kubernetes labels.
This can cause '
+ 'severe performance regressions. Please see '
+
'https://kubernetes.io/docs/concepts/overview/working-with-objects'
+ '/labels/#syntax-and-character-set'
+ 'Given dag_id: %s, task_id: %s', task_id, dag_id
Review comment:
Missing a space here at the start - should probably also wrap the URL in `<>`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services