-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Annual Reports: migration for API class #39
Conversation
4550162
to
f990391
Compare
previous_task = None | ||
for year in years: | ||
fetch_task = fetch_categories_report_count.override( | ||
task_id=f"fetch_report_{year}" | ||
)(year=year) | ||
populate_task = populate_categories_report_count.override( | ||
task_id=f"populate_report_{year}" | ||
)(entry=fetch_task) | ||
if previous_task: | ||
previous_task >> fetch_task | ||
fetch_task >> populate_task | ||
previous_task = populate_task | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to chain the tasks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to run requests to CDS one by one because otherwise, we will break CDS.
My first attempt at this dag implementation was without chaining the tasks, and CDS could not handle it
count = Column(Integer, nullable=False) | ||
year = Column(Integer, nullable=False) | ||
created_at = Column(DateTime, default=func.now()) | ||
updated_at = Column(DateTime, default=func.now(), onupdate=func.now()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we have this it will automatically update the timestamp we don't have to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the comment
|
||
|
||
def get_endpoint(key, year): | ||
cds_token = os.environ.get("CDS_TOKEN", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use the airflow variables for this kind of things.
|
||
def get_endpoint(key, year): | ||
cds_token = os.environ.get("CDS_TOKEN", "") | ||
if cds_token: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the token should be always be there, we can raise and exception if it's missing
More changes to get use of airflow variables feature
514805a
to
53a8d54
Compare
24312a2
to
8343b09
Compare
No description provided.