Adding utility macros around ts
This commit is contained in:
Родитель
7f82a71a9f
Коммит
22c51ffa82
|
@ -1070,6 +1070,7 @@ class TaskInstance(Base):
|
|||
yesterday_ds = (self.execution_date - timedelta(1)).isoformat()[:10]
|
||||
tomorrow_ds = (self.execution_date + timedelta(1)).isoformat()[:10]
|
||||
ds_nodash = ds.replace('-', '')
|
||||
iso = self.execution_date.isoformat()
|
||||
ti_key_str = "{task.dag_id}__{task.task_id}__{ds_nodash}"
|
||||
ti_key_str = ti_key_str.format(**locals())
|
||||
|
||||
|
@ -1096,6 +1097,8 @@ class TaskInstance(Base):
|
|||
return {
|
||||
'dag': task.dag,
|
||||
'ds': ds,
|
||||
'ts': iso,
|
||||
'ts_nodash': iso.replace('-', '').replace(':', ''),
|
||||
'yesterday_ds': yesterday_ds,
|
||||
'tomorrow_ds': tomorrow_ds,
|
||||
'END_DATE': ds,
|
||||
|
|
|
@ -110,6 +110,8 @@ Variable Description
|
|||
``{{ yesterday_ds }}`` yesterday's date as ``YYYY-MM-DD``
|
||||
``{{ tomorrow_ds }}`` tomorrow's date as ``YYYY-MM-DD``
|
||||
``{{ ds }}`` the execution date as ``YYYY-MM-DD``
|
||||
``{{ ts }}`` same as ``execution_date.isoformat()``
|
||||
``{{ ts_nodash }}`` same as ``ts`` without ``-`` and ``:``
|
||||
``{{ execution_date }}`` the execution_date, (datetime.datetime)
|
||||
``{{ dag }}`` the DAG object
|
||||
``{{ task }}`` the Task object
|
||||
|
|
Загрузка…
Ссылка в новой задаче