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 2021/12/04 16:03:38 UTC
[GitHub] [airflow] AlekseiSaff opened a new issue #20037: Can't import DAG
AlekseiSaff opened a new issue #20037:
URL: https://github.com/apache/airflow/issues/20037
### Apache Airflow version
2.2.2 (latest released)
### Operating System
CentOS 7.9
### Versions of Apache Airflow Providers
_No response_
### Deployment
Other
### Deployment details
_No response_
### What happened
I have a python code inside DAG
TRADE_DATE = int({{ data_interval_end.in_timezone('Asia/Hong_Kong').strftime('%Y%m%d') }})
def SRC_DUMP():
if TRADE_DATE >= 20111117:
return f"/mnt/in/market-data/lt-mum1-psr13/{TRADE_DATE}/"
elif TRADE_DATE >= 20110903:
return f"/mnt/in/market-data/lt-mum2-psr06/{TRADE_DATE}/"
else:
return f"/mnt/in/market-data/lt-mum2-psr05/{TRADE_DATE}/"
but during DAG import receiving an error:
Broken DAG: [/home/lt/airflow/dags/process.py] Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/lt/airflow/dags/process.py", line 33, in <module>
TRADE_DATE = int({{ data_interval_end.in_timezone('Asia/Hong_Kong').strftime('%Y%m%d') }})
ValueError: invalid literal for int() with base 10: "{ data_interval_end.in_timezone('Asia/Hong_Kong').strftime('%Y%m%d') }"
it seems like python is not converting the template into real value. Any ideas on how to achieve the needed result?
### What you expected to happen
DAG should be imported
### How to reproduce
_No response_
### Anything else
_No response_
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org