Gantt chart time zone is inconsistent with other views in some cases
There are a few discrepancies between the time reported in the UI between different views and what is set in the DAG file. Specifically, the time is being reported in different timezones.
My DAG is set to run daily at 1:05:00 EST (relevant code below):
default_args = {
...
'start_date': datetime(2015, 8, 4, 1, 5),
'schedule_interval': timedelta(days=1),
...
}
The logs the tasks create show they start at 1:05:00 EST, so that is fine.
Within the UI, time is reported in EST for the Tree View, Task Duration, Landing Times, and individual Task Logs (I assume the former three get time information from the logs?) as shown below.

The UI webserver reports time in the upper-right hand corner.The Gantt View reports time in UTC even if the selected instance is chosen as EST, as shown below.

Is this expected behavior? Or am I correct in thinking that the views should have a synchronized timezone?
Are you not running your server as UTC? I believe everything everywhere should be server time, except maybe for the clock in the navbar that may be forced to UTC. We run everything in UTC here.
So if I understand well only the Gantt chart is off from your server time?
If you mean the actual machine, it's running in EST. If you mean the [web]server, it's set to UTC (yes, like the clock in the navbar; I know where it is set in source code to change it to EST).
The only time (other than the navbar) set to UTC/off from my server time is the Gantt view.
If by machine you mean server, it's probably a bad idea to run your servers on different time zones. Airflow should still be consistent. It's hard for me to debug since it looks ok on my side, I'm not sure how to recreate, do I need a non UTC server to recreate? All of our servers are UTC
Sorry if I was vague.
All machines are running in EST. Airflow reports the clock in the nav bar and the Gantt view as UTC.
Yes, to reproduce it I believe you will need a server not in UTC, specifically the one running the UI.
Current setup: - One machine, in EST: running UI and scheduler - One machine, in EST: running worker no. 1 - One machine, in EST: running worker no. 2
And the two mismatching views are the clock in the UI and the Gantt chart right?
I added a UTC suffix to the UI clock to clarify, it may not be what everyone wants but at least it's clear.
Yes, the navbar clock and the Gantt chart are in UTC. The Gantt view is the more important one.
So if the server is GMT+8, the task will be scheduled according to the server's time. And the UI is forced to use UTC, right? Can we change the timezone of UI? It's really confusing with different timezones in scheduler and UI.
Here's where the javascript code for the clock is if you want to alter it: https://github.com/airbnb/airflow/blob/master/airflow/www/templates/admin/base.html#L81
Maybe the clock's API offer to set the time. If that's the case you can pass it the server's time from the template.
Here's tips, if you want to change clock of airflow webserver page. @haitaoyao I hope this tip can be helpful to you. :)
- the left side of header : clock
- /usr/local/lib/python2.7/site-packages/airflow/www/templates/admin/base.html
<script>
81 x = new Date()
82 //var UTCseconds = (x.getTime() + x.getTimezoneOffset()*60*1000);
83 var seconds = x.getTime();
84 $("#clock").clock({
85 "seconds":"false",
86 "calendar":"false",
87 "format":"24",
88 "timestamp":seconds
89 }).click(function(){
90 alert('{{ hostname }}');
91 });
92 </script>
- the left side of header : UTC text
- /usr/local/lib/python2.7/site-packages/airflow/www/static/jqClock.min.js
<span class='clocktime'>"+p+":"+l+(n.seconds=="true"?":"+v:"")+o+"UTC </span>");t[r]=setTimeout(function(){f($(j),n)},1000)}};f($(this),d)})};
- tree view menu : sorry, it can make a bug. (not tested yet)
- /usr/local/lib/python2.7/site-packages/airflow/www/static/d3.v3.min.js
- Qa.scale.utc -> Qa.scale
- /usr/local/lib/python2.7/site-packages/airflow/www/templates/airflow/tree.html
- /usr/local/lib/python2.7/site-packages/airflow/www/static/d3.v3.min.js
101 var num_square = base_node.instances.length;
102 var extent = d3.extent(base_node.instances, function(d,i) {
103 dttm = new Date(d.execution_date);
104 dttm.setHours(dttm.getHours())
//dttm.setHours(dttm.getHours()+7)
105 return dttm;
106 });
- gantt view
- /usr/local/lib/python2.7/site-packages/airflow/www/static/highcharts.js
- modify : useUTC:!0 -> useUTC:false
26 symbols:["circle","diamond","square","triangle","triangle-down"],lang:{loading:"Loading...",months:"January,February,March,April,May,June,July,Au gust,September,October,November,December".split(","),shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Mo nday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),decimalPoint:".",numericSymbols:"k,M,G,T,P,E".split(","),resetZoom:"Reset zoom",reset ZoomTitle:"Reset zoom level 1:1",thousandsSep:","},global:{useUTC:false,