I have the following:
EXEC_DATE1 = '{{ macros.ds_add(ds, 1) }}'
EXEC_DATE2 = '{{ execution_date }}'
I want to create path variable that looks like:
path1 = EXEC_DATE1 + '/' + HH:MM (of EXEC_DATE1)
path2 = EXEC_DATE2 + '/' + HH:MM (of EXEC_DATE2)
Eventually it should be like:
2018-09-16/10:41
How can I do that?
I tried:
EXEC_DATE = '{{ execution_date }}'
EXEC_DATE = EXEC_DATE.strftime('%Y-%m-%d/%H:%M')
but it gives:
'str' object has no attribute 'strftime'
EDIT: My code:
EXEC_TIMESTAMP_PATH = "{{ execution_date.strftime('%Y-%m-%d/%H:%M') }}"
EXEC_DATE = "{{ execution_date.strftime('%H:%M') }}"
EXEC_TIME = "{{ mexecution_date.strftime('%Y-%m-%d') }}"
task3_op= BashOperator(
task_id='task3',
params={'EXEC_DATE':EXEC_DATE, 'EXEC_TIME':EXEC_TIME},
bash_command="""python3 script.py '{{ var.value.task3_variable }}' '{{ params.EXEC_DATE }}' '{{ params.EXEC_TIME }}' 'file.json'""",
dag=dag)
This doesn't work. The parameters are not rendered.