You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/10/04 09:20:33 UTC

[GitHub] [airflow] ashb commented on a change in pull request #6230: [AIRFLOW-5413] enable K8S pod config from file

ashb commented on a change in pull request #6230: [AIRFLOW-5413] enable K8S pod config from file
URL: https://github.com/apache/airflow/pull/6230#discussion_r331412443
 
 

 ##########
 File path: airflow/executors/kubernetes_executor.py
 ##########
 @@ -373,29 +183,74 @@ def run_next(self, next_job):
         status
         """
         self.log.info('Kubernetes job is %s', str(next_job))
+
         key, command, kube_executor_config = next_job
         dag_id, task_id, execution_date, try_number = key
 
-        config_pod = self.worker_configuration.make_pod(
-            namespace=self.namespace,
-            worker_uuid=self.worker_uuid,
-            pod_id=self._create_pod_id(dag_id, task_id),
-            dag_id=self._make_safe_label_value(dag_id),
-            task_id=self._make_safe_label_value(task_id),
+        safe_dag_id = AirflowKubernetesScheduler._make_safe_label_value(dag_id)
+        safe_task_id = AirflowKubernetesScheduler._make_safe_label_value(task_id)
+        safe_date = AirflowKubernetesScheduler._datetime_to_label_safe_datestring(execution_date)
+        safe_pod_id = AirflowKubernetesScheduler._create_pod_id(dag_id, task_id)
+
+        pod = AirflowKubernetesScheduler.construct_pod(
+            dag_id=safe_dag_id,
+            task_id=safe_task_id,
+            pod_id=safe_pod_id,
             try_number=try_number,
-            execution_date=self._datetime_to_label_safe_datestring(execution_date),
-            airflow_command=command
+            date=safe_date,
+            command=command,
+            kube_executor_config=kube_executor_config,
+            worker_config=self.worker_configuration,
+            namespace=self.namespace,
+            worker_uuid=self.worker_uuid
         )
-        # Reconcile the pod generated by the Operator and the Pod
-        # generated by the .cfg file
-        pod = PodGenerator.reconcile_pods(config_pod, kube_executor_config)
         self.log.debug("Kubernetes running for command %s", command)
         self.log.debug("Kubernetes launching image %s", pod.spec.containers[0].image)
 
         # the watcher will monitor pods, so we do not block.
         self.launcher.run_pod_async(pod, **self.kube_config.kube_client_request_args)
         self.log.debug("Kubernetes Job created!")
 
+    @staticmethod
+    def construct_pod(
 
 Review comment:
   This should function probably all live in the PodGenerator constructor. It is very out of place in a Job _Watcher_ to create something.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services