Metro-Records / la-metro-dashboard

An Airflow-based dashboard for LA Metro
4 stars 0 forks source link

Fix dashboard view #89

Closed hancush closed 2 years ago

hancush commented 2 years ago

The dashboard view is currently broken! 🙀

https://la-metro-dashboard.datamade.us/dashboard/

Let's fix this.

hancush commented 2 years ago

@antidipyramid Ok, so I cannot reproduce this locally. See if you can use the stack trace in the error on the live site to identify where and why the code is breaking. Leave a short summary of the problem in this issue, and we can chat about how best to resolve.

antidipyramid commented 2 years ago

After reading the stack trace, it looks like one of the DAGs is failing at this line in Dashboard.get_dag_info():

Screen Shot 2022-04-14 at 12 46 08 PM

d.following_schedule() seems to be returning None. The source for following_schedule():

Screen Shot 2022-04-14 at 12 48 54 PM

Clearly Airflow wants us to move away from using this function but I'm not sure that that's the problem. I guess the first possibility is that a DAG is returning None for next_dagrun_info().

Did the problem first start when I pushed up the analytics DAG? If so, it's likely that I configured it incorrectly.

hancush commented 2 years ago

@antidipyramid Love the instinct to look for the last change (analytics DAG). Unfortunately, this page was broken before that release. It seems like we have a DAG that does not have a next scheduled run. Can you figure out (based on our DAG files) which one doesn't have a schedule? (Hint: This is definitely my fault!!! 😬)

antidipyramid commented 2 years ago

@hancush Hm, well it seems like the only DAG with no schedule_interval is make_packet.py. That one is explicitly set to None.

If that's it, why can't we reproduce the error locally?

hancush commented 2 years ago

@antidipyramid Try running the make_packet DAG in your local instance, then see if the error occurs.

antidipyramid commented 2 years ago

@hancush Ah ok, I see now! The Dashboard error doesn't appear until Airflow attempts to run make_packet. I thought Dashboard would throw an error even if it hadn't been run yet. What do we want to set the interval as?

hancush commented 2 years ago

make_packet intentionally doesn't have a schedule, because it's triggered by the Metro application. Rather than giving it an interval, I think we need the handle the case where a DAG doesn't have a next scheduled run. Make sense?

antidipyramid commented 2 years ago

@hancush Got it. Adding a simple conditional seems to remove the error:

Screen Shot 2022-04-14 at 3 22 10 PM

I thought this portion of the templates/dashboard.html would throw an error for trying to access pst_time when dag.next_scheduled_date is None but it doesn't on my end. I'm thinking of adding an extra check here just in case.

Screen Shot 2022-04-14 at 3 25 35 PM
hancush commented 2 years ago

Interesting, I would expect that, too. I like the idea of a check so it's explicit that there might not be a next run.