There is a current limitation that Airflow only runs on GMT/UTC. I believe
you are asking for a purely cosmetic change to allow the UI to convert date
times displayed to any TZ. I can't speak to that ability and I expect it's
easy if we assume that we are always converting from GMT/UTC to a
display-only timezone that can be selected from a UI drop-down.

On a related note, it would be awesome if someone could take on a change to
make Airflow TZ aware top-to-bottom and not require it to run strictly in
UTC/GMT.

I recall vineet-rh started addressing this problem in
https://github.com/apache/incubator-airflow/pull/1633

Many of us choose to ignore this since all of our systems run in UTC/GMT,
but I can imagine it's a pain for folks running in legacy data centers
where the policy is to run in a non-GMT/UTC timezone.

-s

On Mon, Oct 10, 2016 at 2:37 AM, weeei he <[email protected]> wrote:

> ---------- 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()
>

Reply via email to