Skip to content
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

[AIRFLOW-3160] (Unrevert) Load latest_dagruns asynchronously #5339

Merged

Conversation

aoen
Copy link
Contributor

@aoen aoen commented May 29, 2019

Unreverting AIRFLOW-3160 which was reverted on suspicious of breaking CI without the clear blame of this PR, and the logs are gone now. A lot of the test code has changed significantly so it's possible that even if an issue was caused by this PR it has since been fixed. Twitter has been running for several months now with this patch with no issues.

Here is the link to the original PR: #4005
Here is the link to the revert PR: #4145

Tested on a local webserver after rebasing the unrevert, and no issues.

I am going to kick off 10 builds in Travis to see if the issue reproduces, and watch the master build for this issue for a couple of days once this is merged. Here are my builds: https://travis-ci.org/aoen/incubator-airflow/builds

@ashb

@codecov-io
Copy link

codecov-io commented May 29, 2019

Codecov Report

Merging #5339 into master will increase coverage by <.01%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5339      +/-   ##
==========================================
+ Coverage   79.02%   79.02%   +<.01%     
==========================================
  Files         481      481              
  Lines       30197    30212      +15     
==========================================
+ Hits        23864    23876      +12     
- Misses       6333     6336       +3
Impacted Files Coverage Δ
airflow/www/views.py 75.91% <93.33%> (+0.18%) ⬆️
airflow/models/taskinstance.py 92.43% <0%> (-0.18%) ⬇️
airflow/models/dag.py 91.75% <0%> (-0.16%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8e87e89...693e141. Read the comment docs.

{% endif %}
<div height="10" width="10" id='last-run-{{ dag.safe_dag_id }}' style="display: block;">
<a></a>
<img class="loading-last-run" width="15" src="{{ url_for("static", filename="loading.gif") }}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This image is wider than the div it's in - does it look okay?

Copy link
Contributor Author

@aoen aoen May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks ok to me in my browser, I agree probably the settings can be cleaned up and this width is strange. This is copied from all of the other async loaded components.

last_run = json[safe_dag_id].last_run;
g = d3.select('div#last-run-' + safe_dag_id)
g.selectAll('a')
.attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + dag_id + "&execution_date=" + last_run)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + dag_id + "&execution_date=" + last_run)
.attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + encodeUriComponent(dag_id) + "&execution_date=" + last_run)

Copy link
Contributor Author

@aoen aoen May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can make this change, seems safe enough and good in general. Note not encoding dag id is a common pattern in the UI (encoding is never done) and probably needs to be factored into some method.

dags_to_latest_runs[dag.dag_id]):
payload[dag.safe_dag_id] = {
'dag_id': dag.dag_id,
'last_run': dags_to_latest_runs[dag.dag_id].strftime("%Y-%m-%d %H:%M")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be .isoformat()? (or at least include seconds and MS)

Copy link
Contributor Author

@aoen aoen May 30, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might make the UI look too crowded, and not sure if there is value to users to have this additional information. This PR maintains the same format as before in the non-async version: https://github.com/apache/airflow/pull/5339/files#diff-f38558559ea1b4c30ddf132b7f223cf9L111

@aoen aoen force-pushed the ddavydov--revert_revery_load_latest_dagruns_async branch from 1cc5ef2 to 2f03e26 Compare May 30, 2019 17:19
@aoen
Copy link
Contributor Author

aoen commented May 31, 2019

Addressed feedback @ashb

last_run = json[safe_dag_id].last_run;
g = d3.select('div#last-run-' + safe_dag_id)
g.selectAll('a')
.attr("href", "{{ url_for('Airflow.graph') }}?dag_id=" + encodeUriComponent(dag_id) + "&execution_date=" + last_run)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: encodeURIComponent

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whops that was my bad.

@msumit
Copy link
Contributor

msumit commented Jun 6, 2019

lgtm

@aoen aoen force-pushed the ddavydov--revert_revery_load_latest_dagruns_async branch from 2f03e26 to 693e141 Compare June 6, 2019 14:38
@aoen
Copy link
Contributor Author

aoen commented Jun 6, 2019

Good catch Sumit! Fixed and tested.

Not your fault Ash, falls on me, but I usually do UI tests after back-and-forth comments so would have caught this at the end.

@msumit msumit merged commit f19db28 into apache:master Jun 6, 2019
andriisoldatenko pushed a commit to andriisoldatenko/airflow that referenced this pull request Jul 26, 2019
wmorris75 pushed a commit to modmed/incubator-airflow that referenced this pull request Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants