---------- Forwarded message ----------
From: weeei he <[email protected]>
Date: 2016-10-10 12:04 GMT+08:00
Subject: Change Airflow Timezone
To: [email protected]
Cc: [email protected]
The display time is UTC on the Airflow ui, such as the right top and
Gantt Chart Page.
Can I change the time to Local Time and how should I do?
I temporarily changed the hard code in *www/templates/admin/master.html* a
nd *www/views.py* .
This is not good solution apparently
/usr/lib/python2.7/site-packages/airflow/www/templates/admin/master.html
12 <script>
13 x = new Date()
14 //MOD
16 var UTCseconds = x.getTime();//(x.getTime() +
x.getTimezoneOffset()*60*1000);
18 $("#clock").clock({
19 "seconds":"false",
20 "calendar":"false",
21 "format":"24",
22 "timestamp":UTCseconds
23 }).click(function(){
24 alert('{{ hostname }}');
25 });
26 $('span').tooltip();
27 </script>
/usr/lib/python2.7/site-packages/airflow/www/views.py
1613 data = []
1614 for i, ti in enumerate(tis):
1615 end_date = ti.end_date or datetime.now()
1616 tasks += [ti.task_id]
1617 color = State.color(ti.state)
1619 low = int(ti.start_date.strftime('%s')) * 1000 + 8 * 60 *
60 * 1000
1620 high = int(end_date.strftime('%s')) * 1000 + 8 * 60 * 60 *
1000
1621 data.append({
1622 'x': i,
1623 'low': low,
1624 'high': high,
1625 'color': color,
1626 })
1628 height = (len(tis) * 25) + 50
1629 session.commit()
1630 session.close()