[PYTHON] Airflow Japanese localization

Premise

Airflow has a web server that allows you to check the progress and logs of scheduled tasks.

Like this スクリーンショット 2016-04-18 17.16.28.png

problem

However, this is fixed in UTC. So even if it works with JST, it will be UTC on the screen. It's pretty painful because I have to convert the time in my head. There are issues about this, but they haven't been merged yet. https://github.com/airbnb/airflow/issues/227

solution

** Common to all **

I'll manually fix the hard-coded part of the issue above: ghost:

/usr/local/lib/python2.7/site-packages/airflow/www/templates/admin/master.html Use x.getTime () instead of UTC seconds set as timestamp.

x = new Date()
//var UTCseconds = (x.getTime() + x.getTimezoneOffset()*60*1000);
var seconds = x.getTime();
$("#clock").clock({
    "seconds":"false",
    "calendar":"false",
    "format":"24",
    "timestamp":seconds
}).click(function(){
    alert('{{ hostname }}');
});
$('span').tooltip();

/usr/local/lib/python2.7/site-packages/airflow/www/static/jqClock.min.js Since " UTC </ span> " is written in the code part below, change this to an arbitrary character string.

<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 /usr/local/lib/python2.7/site-packages/airflow/www/static/d3.v3.min.js Change Qa.scale.utc to Qa.scale.

/usr/local/lib/python2.7/site-packages/airflow/www/templates/airflow/tree.html Since it has been plus 7 hours with dttm.setHours (dttm.getHours () + 7), I will set it to dttm.setHours (dttm.getHours ()).

  var extent = d3.extent(base_node.instances, function(d,i) {
    dttm = new Date(d.execution_date);
    dttm.setHours(dttm.getHours());
    //dttm.setHours(dttm.getHours()+7)
    return dttm;
  });

gantt view /usr/local/lib/python2.7/site-packages/airflow/www/static/highcharts.js I'll change from ʻuse UTC:! 0 to ʻuse UTC: false

Finally

This makes it a little easier to see

Recommended Posts

Airflow Japanese localization
Japanese localization of Pycharm
PyCharm Japanese localization (resources_jp)
Japanese localization setting of PyCharm
[PyCharm] Japanese localization procedure (version 2020.1.2 or later)
[Python] Japanese localization of matplotlib on Ubuntu
Coexistence of Fcitx and Zoom ~ With Japanese localization ~