def test_init_with_template_cluster_label(self):
        dag = DAG(DAG_ID, start_date=DEFAULT_DATE)
        task = QuboleOperator(task_id=TASK_ID,
                              dag=dag,
                              cluster_label='{{ params.cluster_label }}',
                              params={'cluster_label': 'default'})

        ti = TaskInstance(task, DEFAULT_DATE)
        ti.render_templates()

        self.assertEqual(task.cluster_label, 'default')
示例#2
0
 def __init__(self, ti: TaskInstance, render_templates=True):
     self.dag_id = ti.dag_id
     self.task_id = ti.task_id
     self.task = ti.task
     self.execution_date = ti.execution_date
     self.ti = ti
     if render_templates:
         ti.render_templates()
     self.rendered_fields = {
         field: serialize_template_field(getattr(self.task, field))
         for field in self.task.template_fields
     }
 def __init__(self, ti: TaskInstance, render_templates=True):
     self.dag_id = ti.dag_id
     self.task_id = ti.task_id
     self.task = ti.task
     self.execution_date = ti.execution_date
     self.ti = ti
     if render_templates:
         ti.render_templates()
     if os.environ.get("AIRFLOW_IS_K8S_EXECUTOR_POD", None):
         self.k8s_pod_yaml = ti.render_k8s_pod_yaml()
     self.rendered_fields = {
         field: serialize_template_field(getattr(self.task, field)) for field in self.task.template_fields
     }
示例#4
0
 def __init__(self, ti: TaskInstance, render_templates=True):
     self.dag_id = ti.dag_id
     self.task_id = ti.task_id
     self.task = ti.task
     self.execution_date = ti.execution_date
     self.ti = ti
     if render_templates:
         ti.render_templates()
     if IS_K8S_OR_K8SCELERY_EXECUTOR:
         self.k8s_pod_yaml = ti.render_k8s_pod_yaml()
     self.rendered_fields = {
         field: serialize_template_field(getattr(self.task, field))
         for field in self.task.template_fields
     }