def _set_parameters(self, ti, try_number=0): self.parameters['dag_id'] = ti.dag_id self.parameters['task_id'] = ti.task_id self.parameters['try_number'] = str( try_number if try_number else ti.try_number) self.parameters[ 'execution_date'] = AirflowKubernetesScheduler._datetime_to_label_safe_datestring( ti.execution_date)
def test_execution_date_serialize_deserialize(self): datetime_obj = datetime.now() serialized_datetime = \ AirflowKubernetesScheduler._datetime_to_label_safe_datestring( datetime_obj) new_datetime_obj = AirflowKubernetesScheduler._label_safe_datestring_to_datetime( serialized_datetime) self.assertEqual(datetime_obj, new_datetime_obj)
def test_execution_date_serialize_deserialize(self): datetime_obj = datetime.now() serialized_datetime = \ AirflowKubernetesScheduler._datetime_to_label_safe_datestring( datetime_obj) new_datetime_obj = AirflowKubernetesScheduler._label_safe_datestring_to_datetime( serialized_datetime) self.assertEquals(datetime_obj, new_datetime_obj)