You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/01/02 09:38:58 UTC

[GitHub] [airflow] ohadmata opened a new pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

ohadmata opened a new pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998
 
 
   Add ANSI color support in order to use standard packages like colorama (https://pypi.org/project/colorama/).
   
   The coloring commands are:
   
   `ESC [ 0 m       # reset all (colors and brightness)
   
   # FOREGROUND:
   ESC [ 30 m      # black
   ESC [ 31 m      # red
   ESC [ 32 m      # green
   ESC [ 33 m      # yellow
   ESC [ 34 m      # blue
   ESC [ 35 m      # magenta
   ESC [ 36 m      # cyan
   ESC [ 37 m      # white
   
   # BACKGROUND
   ESC [ 40 m      # black
   ESC [ 41 m      # red
   ESC [ 42 m      # green
   ESC [ 43 m      # yellow
   ESC [ 44 m      # blue
   ESC [ 45 m      # magenta
   ESC [ 46 m      # cyan
   ESC [ 47 m      # white`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365592237
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + Style.RESET_ALL)
 
 Review comment:
   If I am not mistaken the log will be colored two times? Once by color log formatter, the second time by adding codes here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570741921
 
 
   Does Airflow write escape characters in logs?  It seems to me that these characters are deleted.  https://github.com/apache/airflow/blob/master/airflow/utils/log/logging_mixin.py#L28-L33

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366219446
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -22,6 +22,7 @@
 import requests
 import tenacity
 
+from airflow import conf
 
 Review comment:
   Is this a related change?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372233998
 
 

 ##########
 File path: airflow/contrib/kubernetes/pod_launcher.py
 ##########
 @@ -122,6 +122,8 @@ def _monitor_pod(self, pod, get_logs):
         if get_logs:
             logs = self.read_pod_logs(pod)
             for line in logs:
+                if isinstance(line, bytes):
+                    line = line.decode('utf-8').strip()
 
 Review comment:
   I revert this change

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r363520408
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   This looks good for now. In the future, I think we should move the JS code to separate files and then download this library using npm and webpack.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366299681
 
 

 ##########
 File path: airflow/config_templates/default_airflow.cfg
 ##########
 @@ -67,6 +67,9 @@ colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatte
 log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
 simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s
 
+# Colored logs in the WebUI (ANSI Colour)
+colored_ui_logs = False
 
 Review comment:
   New config options should be added to airflow/config_templates/config.yml which will then auto-generate this file and our docs.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r363417731
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   @mik-laj can you advise?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372657065
 
 

 ##########
 File path: airflow/contrib/kubernetes/pod_launcher.py
 ##########
 @@ -121,6 +121,7 @@ def _monitor_pod(self, pod, get_logs):
 
         if get_logs:
             logs = self.read_pod_logs(pod)
+            
 
 Review comment:
   Please avoid making unrelated changes.
   
   ```suggestion
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-571564944
 
 
   You need to add Apache license header. Otherwise Travis will never be happy.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365896143
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + Style.RESET_ALL)
 
 Review comment:
   I don't understand. where is this color log formatter?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r363270012
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   The CI check failed because of there is no Apache header. This is a problem?
   The ansi_up library is MIT licensing 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372658148
 
 

 ##########
 File path: airflow/www/static/ansi_up.min.js
 ##########
 @@ -0,0 +1,7 @@
+/*  ansi_up.js
+ *  author : Dru Nelson
+ *  license : MIT
+ *  http://github.com/drudru/ansi_up
+ */
+!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("object"==typeof exports&&"string"!=typeof exports.nodeName)t(exports);else{var n={};t(n),e.AnsiUp=n.default}}(this,function(e){"use strict";var t,n=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e};!function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"}(t||(t={}));var i=function(){function e(){this.VERSION="4.0.4",this.setup_palettes(),this._use_classes=!1,this._escape_for_html=!0,this.bold=!1,this.fg=this.bg=null,this._buffer="",this._url_whitelist={http:1,https:1}}return Object.defineProperty(e.prototype,"use_classes",{get:function(){return this._use_classes},set:function(e){this._use_classes=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"escape_for_html",{get:function(){return this._escape_for_html},set:function(e){this._escape_for_html=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url_whitelist",{get:function(){return this._url_whitelist},set:function(e){this._url_whitelist=e},enumerable:!0,configurable:!0}),e.prototype.setup_palettes=function(){var e=this;this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(function(t){t.forEach(function(t){e.palette_256.push(t)})});for(var t=[0,95,135,175,215,255],n=0;n<6;++n)for(var i=0;i<6;++i)for(var s=0;s<6;++s){var r={rgb:[t[n],t[i],t[s]],class_name:"truecolor"};this.palette_256.push(r)}for(var a=8,l=0;l<24;++l,a+=10){var f={rgb:[a,a,a],class_name:"truecolor"};this.palette_256.push(f)}},e.prototype.escape_txt_for_html=function(e){return e.replace(/[&<>]/gm,function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":void 0})},e.prototype.append_buffer=function(e){var t=this._buffer+e;this._buffer=t},e.prototype.get_next_packet=function(){var e={kind:t.EOS,text:"",url:""},i=this._buffer.length;if(0==i)return e;var r=this._buffer.indexOf("");if(-1==r)return e.kind=t.Text,e.text=this._buffer,this._buffer="",e;if(r>0)return e.kind=t.Text,e.text=this._buffer.slice(0,r),this._buffer=this._buffer.slice(r),e;if(0==r){if(1==i)return e.kind=t.Incomplete,e;var a=this._buffer.charAt(1);if("["!=a&&"]"!=a)return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if("["==a){if(this._csi_regex||(this._csi_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          [                      # CSI\n                          ([<-?]?)              # private-mode char\n                          ([d;]*)                    # any digits or semicolons\n                          ([ -/]?               # an intermediate modifier\n                          [@-~])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          [                      # CSI\n                          [ -~]*                # anything legal\n                          ([\0-:])              # anything illegal\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          \\x1b\\[                      # CSI\n                          ([\\x3c-\\x3f]?)              # private-mode char\n                          ([\\d;]*)                    # any digits or semicolons\n                          ([\\x20-\\x2f]?               # an intermediate modifier\n                          [\\x40-\\x7e])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          \\x1b\\[                      # CSI\n                          [\\x20-\\x7e]*                # anything legal\n                          ([\\x00-\\x1f:])              # anything illegal\n                        )\n                    "]))),null===(h=this._buffer.match(this._csi_regex)))return e.kind=t.Incomplete,e;if(h[4])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;""!=h[1]||"m"!=h[3]?e.kind=t.Unknown:e.kind=t.SGR,e.text=h[2];var l=h[0].length;return this._buffer=this._buffer.slice(l),e}if("]"==a){if(i<4)return e.kind=t.Incomplete,e;if("8"!=this._buffer.charAt(2)||";"!=this._buffer.charAt(3))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||(this._osc_st=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0],s=i.replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(s,"g")}(n(["\n                        (?:                         # legal sequence\n                          (\\)                    # ESC                           |                           # alternate\n                          ()                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\0-]                 # anything illegal\n                          |                           # alternate\n                          [\b-]                 # anything illegal\n                          |                           # alternate\n                          [-]                 # anything illegal\n                        )\n                    "],["\n                        (?:                         # legal sequence\n                          (\\x1b\\\\)                    # ESC \\\n                          |                           # alternate\n                          (\\x07)                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\\x00-\\x06]                 # anything illegal\n                          |                           # alternate\n                          [\\x08-\\x1a]                 # anything illegal\n                          |                           # alternate\n                          [\\x1c-\\x1f]                 # anything illegal\n                        )\n                    "]))),this._osc_st.lastIndex=0;var f=this._osc_st.exec(this._buffer);if(null===f)return e.kind=t.Incomplete,e;if(f[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;var h,o=this._osc_st.exec(this._buffer);if(null===o)return e.kind=t.Incomplete,e;if(o[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(this._osc_regex||(this._osc_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                        ]8;                    # OSC Hyperlink\n                        [ -:<-~]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([!-~]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                        ([!-~]+)              # TEXT capture\n                        ]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                        \\x1b\\]8;                    # OSC Hyperlink\n                        [\\x20-\\x3a\\x3c-\\x7e]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([\\x21-\\x7e]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                        ([\\x21-\\x7e]+)              # TEXT capture\n                        \\x1b\\]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                    "]))),null===(h=this._buffer.match(this._osc_regex)))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t.OSCURL,e.url=h[1],e.text=h[2];l=h[0].length;return this._buffer=this._buffer.slice(l),e}}},e.prototype.ansi_to_html=function(e){this.append_buffer(e);for(var n=[];;){var i=this.get_next_packet();if(i.kind==t.EOS||i.kind==t.Incomplete)break;i.kind!=t.ESC&&i.kind!=t.Unknown&&(i.kind==t.Text?n.push(this.transform_to_html(this.with_state(i))):i.kind==t.SGR?this.process_ansi(i):i.kind==t.OSCURL&&n.push(this.process_hyperlink(i)))}return n.join("")},e.prototype.with_state=function(e){return{bold:this.bold,fg:this.fg,bg:this.bg,text:e.text}},e.prototype.process_ansi=function(e){for(var t=e.text.split(";");t.length>0;){var n=t.shift(),i=parseInt(n,10);if(isNaN(i)||0===i)this.fg=this.bg=null,this.bold=!1;else if(1===i)this.bold=!0;else if(22===i)this.bold=!1;else if(39===i)this.fg=null;else if(49===i)this.bg=null;else if(i>=30&&i<38)this.fg=this.ansi_colors[0][i-30];else if(i>=40&&i<48)this.bg=this.ansi_colors[0][i-40];else if(i>=90&&i<98)this.fg=this.ansi_colors[1][i-90];else if(i>=100&&i<108)this.bg=this.ansi_colors[1][i-100];else if((38===i||48===i)&&t.length>0){var s=38===i,r=t.shift();if("5"===r&&t.length>0){var a=parseInt(t.shift(),10);a>=0&&a<=255&&(s?this.fg=this.palette_256[a]:this.bg=this.palette_256[a])}if("2"===r&&t.length>2){var l=parseInt(t.shift(),10),f=parseInt(t.shift(),10),h=parseInt(t.shift(),10);if(l>=0&&l<=255&&f>=0&&f<=255&&h>=0&&h<=255){var o={rgb:[l,f,h],class_name:"truecolor"};s?this.fg=o:this.bg=o}}}}},e.prototype.transform_to_html=function(e){var t=e.text;if(0===t.length)return t;if(this._escape_for_html&&(t=this.escape_txt_for_html(t)),!e.bold&&null===e.fg&&null===e.bg)return t;var n=[],i=[],s=e.fg,r=e.bg;e.bold&&n.push("font-weight:bold"),this._use_classes?(s&&("truecolor"!==s.class_name?i.push(s.class_name+"-fg"):n.push("color:rgb("+s.rgb.join(",")+")")),r&&("truecolor"!==r.class_name?i.push(r.class_name+"-bg"):n.push("background-color:rgb("+r.rgb.join(",")+")"))):(s&&n.push("color:rgb("+s.rgb.join(",")+")"),r&&n.push("background-color:rgb("+r.rgb+")"));var a="",l="";return i.length&&(a=' class="'+i.join(" ")+'"'),n.length&&(l=' style="'+n.join(";")+'"'),"<span"+l+a+">"+t+"</span>"},e.prototype.process_hyperlink=function(e){var t=e.url.split(":");return t.length<1?"":this._url_whitelist[t[0]]?'<a href="'+this.escape_txt_for_html(e.url)+'">'+this.escape_txt_for_html(e.text)+"</a>":""},e}();function s(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(i)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i});
+//# sourceMappingURL=/sm/e54fac82455c5244f73ba6a437a8ca0fefeba655e9f1fae1535a2c5dad960c25.map
 
 Review comment:
   Where did you get this file from btw? And what version of ansi_up does it related to?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r388252440
 
 

 ##########
 File path: airflow/www/static/ansi_up.min.js
 ##########
 @@ -0,0 +1,7 @@
+/*  ansi_up.js
+ *  author : Dru Nelson
+ *  license : MIT
+ *  http://github.com/drudru/ansi_up
+ */
+!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("object"==typeof exports&&"string"!=typeof exports.nodeName)t(exports);else{var n={};t(n),e.AnsiUp=n.default}}(this,function(e){"use strict";var t,n=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e};!function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"}(t||(t={}));var i=function(){function e(){this.VERSION="4.0.4",this.setup_palettes(),this._use_classes=!1,this._escape_for_html=!0,this.bold=!1,this.fg=this.bg=null,this._buffer="",this._url_whitelist={http:1,https:1}}return Object.defineProperty(e.prototype,"use_classes",{get:function(){return this._use_classes},set:function(e){this._use_classes=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"escape_for_html",{get:function(){return this._escape_for_html},set:function(e){this._escape_for_html=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url_whitelist",{get:function(){return this._url_whitelist},set:function(e){this._url_whitelist=e},enumerable:!0,configurable:!0}),e.prototype.setup_palettes=function(){var e=this;this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(function(t){t.forEach(function(t){e.palette_256.push(t)})});for(var t=[0,95,135,175,215,255],n=0;n<6;++n)for(var i=0;i<6;++i)for(var s=0;s<6;++s){var r={rgb:[t[n],t[i],t[s]],class_name:"truecolor"};this.palette_256.push(r)}for(var a=8,l=0;l<24;++l,a+=10){var f={rgb:[a,a,a],class_name:"truecolor"};this.palette_256.push(f)}},e.prototype.escape_txt_for_html=function(e){return e.replace(/[&<>]/gm,function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":void 0})},e.prototype.append_buffer=function(e){var t=this._buffer+e;this._buffer=t},e.prototype.get_next_packet=function(){var e={kind:t.EOS,text:"",url:""},i=this._buffer.length;if(0==i)return e;var r=this._buffer.indexOf("");if(-1==r)return e.kind=t.Text,e.text=this._buffer,this._buffer="",e;if(r>0)return e.kind=t.Text,e.text=this._buffer.slice(0,r),this._buffer=this._buffer.slice(r),e;if(0==r){if(1==i)return e.kind=t.Incomplete,e;var a=this._buffer.charAt(1);if("["!=a&&"]"!=a)return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if("["==a){if(this._csi_regex||(this._csi_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          [                      # CSI\n                          ([<-?]?)              # private-mode char\n                          ([d;]*)                    # any digits or semicolons\n                          ([ -/]?               # an intermediate modifier\n                          [@-~])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          [                      # CSI\n                          [ -~]*                # anything legal\n                          ([\0-:])              # anything illegal\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          \\x1b\\[                      # CSI\n                          ([\\x3c-\\x3f]?)              # private-mode char\n                          ([\\d;]*)                    # any digits or semicolons\n                          ([\\x20-\\x2f]?               # an intermediate modifier\n                          [\\x40-\\x7e])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          \\x1b\\[                      # CSI\n                          [\\x20-\\x7e]*                # anything legal\n                          ([\\x00-\\x1f:])              # anything illegal\n                        )\n                    "]))),null===(h=this._buffer.match(this._csi_regex)))return e.kind=t.Incomplete,e;if(h[4])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;""!=h[1]||"m"!=h[3]?e.kind=t.Unknown:e.kind=t.SGR,e.text=h[2];var l=h[0].length;return this._buffer=this._buffer.slice(l),e}if("]"==a){if(i<4)return e.kind=t.Incomplete,e;if("8"!=this._buffer.charAt(2)||";"!=this._buffer.charAt(3))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||(this._osc_st=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0],s=i.replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(s,"g")}(n(["\n                        (?:                         # legal sequence\n                          (\\)                    # ESC                           |                           # alternate\n                          ()                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\0-]                 # anything illegal\n                          |                           # alternate\n                          [\b-]                 # anything illegal\n                          |                           # alternate\n                          [-]                 # anything illegal\n                        )\n                    "],["\n                        (?:                         # legal sequence\n                          (\\x1b\\\\)                    # ESC \\\n                          |                           # alternate\n                          (\\x07)                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\\x00-\\x06]                 # anything illegal\n                          |                           # alternate\n                          [\\x08-\\x1a]                 # anything illegal\n                          |                           # alternate\n                          [\\x1c-\\x1f]                 # anything illegal\n                        )\n                    "]))),this._osc_st.lastIndex=0;var f=this._osc_st.exec(this._buffer);if(null===f)return e.kind=t.Incomplete,e;if(f[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;var h,o=this._osc_st.exec(this._buffer);if(null===o)return e.kind=t.Incomplete,e;if(o[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(this._osc_regex||(this._osc_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                        ]8;                    # OSC Hyperlink\n                        [ -:<-~]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([!-~]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                        ([!-~]+)              # TEXT capture\n                        ]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                        \\x1b\\]8;                    # OSC Hyperlink\n                        [\\x20-\\x3a\\x3c-\\x7e]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([\\x21-\\x7e]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                        ([\\x21-\\x7e]+)              # TEXT capture\n                        \\x1b\\]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                    "]))),null===(h=this._buffer.match(this._osc_regex)))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t.OSCURL,e.url=h[1],e.text=h[2];l=h[0].length;return this._buffer=this._buffer.slice(l),e}}},e.prototype.ansi_to_html=function(e){this.append_buffer(e);for(var n=[];;){var i=this.get_next_packet();if(i.kind==t.EOS||i.kind==t.Incomplete)break;i.kind!=t.ESC&&i.kind!=t.Unknown&&(i.kind==t.Text?n.push(this.transform_to_html(this.with_state(i))):i.kind==t.SGR?this.process_ansi(i):i.kind==t.OSCURL&&n.push(this.process_hyperlink(i)))}return n.join("")},e.prototype.with_state=function(e){return{bold:this.bold,fg:this.fg,bg:this.bg,text:e.text}},e.prototype.process_ansi=function(e){for(var t=e.text.split(";");t.length>0;){var n=t.shift(),i=parseInt(n,10);if(isNaN(i)||0===i)this.fg=this.bg=null,this.bold=!1;else if(1===i)this.bold=!0;else if(22===i)this.bold=!1;else if(39===i)this.fg=null;else if(49===i)this.bg=null;else if(i>=30&&i<38)this.fg=this.ansi_colors[0][i-30];else if(i>=40&&i<48)this.bg=this.ansi_colors[0][i-40];else if(i>=90&&i<98)this.fg=this.ansi_colors[1][i-90];else if(i>=100&&i<108)this.bg=this.ansi_colors[1][i-100];else if((38===i||48===i)&&t.length>0){var s=38===i,r=t.shift();if("5"===r&&t.length>0){var a=parseInt(t.shift(),10);a>=0&&a<=255&&(s?this.fg=this.palette_256[a]:this.bg=this.palette_256[a])}if("2"===r&&t.length>2){var l=parseInt(t.shift(),10),f=parseInt(t.shift(),10),h=parseInt(t.shift(),10);if(l>=0&&l<=255&&f>=0&&f<=255&&h>=0&&h<=255){var o={rgb:[l,f,h],class_name:"truecolor"};s?this.fg=o:this.bg=o}}}}},e.prototype.transform_to_html=function(e){var t=e.text;if(0===t.length)return t;if(this._escape_for_html&&(t=this.escape_txt_for_html(t)),!e.bold&&null===e.fg&&null===e.bg)return t;var n=[],i=[],s=e.fg,r=e.bg;e.bold&&n.push("font-weight:bold"),this._use_classes?(s&&("truecolor"!==s.class_name?i.push(s.class_name+"-fg"):n.push("color:rgb("+s.rgb.join(",")+")")),r&&("truecolor"!==r.class_name?i.push(r.class_name+"-bg"):n.push("background-color:rgb("+r.rgb.join(",")+")"))):(s&&n.push("color:rgb("+s.rgb.join(",")+")"),r&&n.push("background-color:rgb("+r.rgb+")"));var a="",l="";return i.length&&(a=' class="'+i.join(" ")+'"'),n.length&&(l=' style="'+n.join(";")+'"'),"<span"+l+a+">"+t+"</span>"},e.prototype.process_hyperlink=function(e){var t=e.url.split(":");return t.length<1?"":this._url_whitelist[t[0]]?'<a href="'+this.escape_txt_for_html(e.url)+'">'+this.escape_txt_for_html(e.text)+"</a>":""},e}();function s(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(i)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i});
+//# sourceMappingURL=/sm/e54fac82455c5244f73ba6a437a8ca0fefeba655e9f1fae1535a2c5dad960c25.map
 
 Review comment:
   This is the latest version (4.0.4).
   I generated this minified version by myself from the source ansi_up.js file.
   because I couldn't find the minified version in the ansi_up repo

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372235379
 
 

 ##########
 File path: airflow/config_templates/default_test.cfg
 ##########
 @@ -52,6 +52,7 @@ secure_mode = False
 hostname_callable = socket:getfqdn
 worker_precheck = False
 default_task_retries = 0
+colored_ui_logs = False
 
 Review comment:
   ok

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362422039
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   Will it work if the text is multi-colored?  What do you think about using [ansi_up.js](https://github.com/drudru/ansi_up) (License: MIT - Apache compatible) ? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362526965
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   I tested the change in a local environment with ansi_up and it's working like a magic :-)
   The problem is that I don't know where I should inclute the new js file.
   Some help please 
   
   Edit: I see that other resource file (Like bootstrap/jquery) stored in: /admin/admin/vendor
   But I cant find it in the source code :-(

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362526965
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   I tested the change in a local environment with ansi_up and it's working like a magic :-)
   The problem is that I don't know where I should inclute the new js file.
   Some help please 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-571117654
 
 
   The CI check failed because of there is no Apache header. This is a problem?
   The ansi_up library is MIT licensing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570168665
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=h1) Report
   > Merging [#6998](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=desc) into [v1-10-stable](https://codecov.io/gh/apache/airflow/commit/c8597cbf143b970ad3c7b0d62e3b44d1dfdc8afe?src=pr&el=desc) will **decrease** coverage by `0.2%`.
   > The diff coverage is `100%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/6998/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree)
   
   ```diff
   @@               Coverage Diff               @@
   ##           v1-10-stable   #6998      +/-   ##
   ===============================================
   - Coverage          81.5%   81.3%   -0.21%     
   ===============================================
     Files               526     526              
     Lines             36032   36032              
   ===============================================
   - Hits              29368   29295      -73     
   - Misses             6664    6737      +73
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/utils/log/logging\_mixin.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9sb2cvbG9nZ2luZ19taXhpbi5weQ==) | `95.4% <100%> (-1.15%)` | :arrow_down: |
   | [airflow/executors/sequential\_executor.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvc2VxdWVudGlhbF9leGVjdXRvci5weQ==) | `50% <0%> (-50%)` | :arrow_down: |
   | [airflow/utils/sqlalchemy.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9zcWxhbGNoZW15LnB5) | `90.47% <0%> (-6.35%)` | :arrow_down: |
   | [airflow/utils/dag\_processing.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9kYWdfcHJvY2Vzc2luZy5weQ==) | `86.52% <0%> (-5.52%)` | :arrow_down: |
   | [airflow/utils/helpers.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9oZWxwZXJzLnB5) | `75% <0%> (-5.19%)` | :arrow_down: |
   | [airflow/executors/\_\_init\_\_.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvX19pbml0X18ucHk=) | `78.84% <0%> (-1.93%)` | :arrow_down: |
   | [airflow/jobs/scheduler\_job.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9qb2JzL3NjaGVkdWxlcl9qb2IucHk=) | `88.74% <0%> (-1.17%)` | :arrow_down: |
   | [airflow/models/taskinstance.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvdGFza2luc3RhbmNlLnB5) | `93.53% <0%> (-0.49%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=footer). Last update [c8597cb...5d2f8e8](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r363270012
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   The CI check failed because of there is no Apache header. This is a problem?
   The ansi_up library is MIT licensing 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366219349
 
 

 ##########
 File path: airflow/contrib/kubernetes/pod_launcher.py
 ##########
 @@ -122,6 +122,8 @@ def _monitor_pod(self, pod, get_logs):
         if get_logs:
             logs = self.read_pod_logs(pod)
             for line in logs:
+                if isinstance(line, bytes):
+                    line = line.decode('utf-8').strip()
 
 Review comment:
   Is this a related change?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366299165
 
 

 ##########
 File path: airflow/contrib/kubernetes/pod_launcher.py
 ##########
 @@ -122,6 +122,8 @@ def _monitor_pod(self, pod, get_logs):
         if get_logs:
             logs = self.read_pod_logs(pod)
             for line in logs:
+                if isinstance(line, bytes):
+                    line = line.decode('utf-8').strip()
 
 Review comment:
   Given all this is loop is doing is reading in from one place and writing out somewhere else it should be fine as binary.
   
   Please explain why this change is needed in more detail. What happened without it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366299377
 
 

 ##########
 File path: airflow/config_templates/default_test.cfg
 ##########
 @@ -52,6 +52,7 @@ secure_mode = False
 hostname_callable = socket:getfqdn
 worker_precheck = False
 default_task_retries = 0
+colored_ui_logs = False
 
 Review comment:
   You don't need to add values to this file unless they are different from the default.
   ```suggestion
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570776948
 
 
   > Does Airflow write escape characters in logs? It seems to me that these characters are deleted. https://github.com/apache/airflow/blob/master/airflow/utils/log/logging_mixin.py#L28-L33
   
   That's true but this PR remove escaping the ANSI codes.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-571479829
 
 
   I added new configuration. Someone know why the automatic CI failed?
   thanks

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366037476
 
 

 ##########
 File path: airflow/utils/log/logging_mixin.py
 ##########
 @@ -109,7 +110,10 @@ def _propagate_log(self, message):
         """
         Propagate message removing escape codes.
         """
-        self.logger.log(self.level, remove_escape_codes(message))
+        if conf.getboolean('core', 'colored_ui_logs'):
+            self.logger.log(self.level, message)
+        else:
+            self.logger.log(self.level, remove_escape_codes(message))
 
 Review comment:
   Stackdriver doesn't support colored logs. Many other external task handlers also. This can also be problematic for other handlers. We'd have to test it with all the handles to make sure we can turn it on by default.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366299150
 
 

 ##########
 File path: airflow/utils/log/logging_mixin.py
 ##########
 @@ -109,7 +110,10 @@ def _propagate_log(self, message):
         """
         Propagate message removing escape codes.
         """
-        self.logger.log(self.level, remove_escape_codes(message))
+        if conf.getboolean('core', 'colored_ui_logs'):
+            self.logger.log(self.level, message)
+        else:
+            self.logger.log(self.level, remove_escape_codes(message))
 
 Review comment:
   ElasticSearch is the same -- it would make searching more tricky if ANSI escape sequences got fed in to ES.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362482454
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   +1 for using existing solution

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365897719
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + Style.RESET_ALL)
 
 Review comment:
   You are talking about this file?
   `airflow/utils/log/colored_log.py 
   `
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365899761
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + Style.RESET_ALL)
 
 Review comment:
   I removed this change (and the colorama package)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372657932
 
 

 ##########
 File path: airflow/www/static/ansi_up.min.js
 ##########
 @@ -0,0 +1,7 @@
+/*  ansi_up.js
+ *  author : Dru Nelson
+ *  license : MIT
+ *  http://github.com/drudru/ansi_up
+ */
+!function(e,t){if("function"==typeof define&&define.amd)define(["exports"],t);else if("object"==typeof exports&&"string"!=typeof exports.nodeName)t(exports);else{var n={};t(n),e.AnsiUp=n.default}}(this,function(e){"use strict";var t,n=this&&this.__makeTemplateObject||function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e};!function(e){e[e.EOS=0]="EOS",e[e.Text=1]="Text",e[e.Incomplete=2]="Incomplete",e[e.ESC=3]="ESC",e[e.Unknown=4]="Unknown",e[e.SGR=5]="SGR",e[e.OSCURL=6]="OSCURL"}(t||(t={}));var i=function(){function e(){this.VERSION="4.0.4",this.setup_palettes(),this._use_classes=!1,this._escape_for_html=!0,this.bold=!1,this.fg=this.bg=null,this._buffer="",this._url_whitelist={http:1,https:1}}return Object.defineProperty(e.prototype,"use_classes",{get:function(){return this._use_classes},set:function(e){this._use_classes=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"escape_for_html",{get:function(){return this._escape_for_html},set:function(e){this._escape_for_html=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"url_whitelist",{get:function(){return this._url_whitelist},set:function(e){this._url_whitelist=e},enumerable:!0,configurable:!0}),e.prototype.setup_palettes=function(){var e=this;this.ansi_colors=[[{rgb:[0,0,0],class_name:"ansi-black"},{rgb:[187,0,0],class_name:"ansi-red"},{rgb:[0,187,0],class_name:"ansi-green"},{rgb:[187,187,0],class_name:"ansi-yellow"},{rgb:[0,0,187],class_name:"ansi-blue"},{rgb:[187,0,187],class_name:"ansi-magenta"},{rgb:[0,187,187],class_name:"ansi-cyan"},{rgb:[255,255,255],class_name:"ansi-white"}],[{rgb:[85,85,85],class_name:"ansi-bright-black"},{rgb:[255,85,85],class_name:"ansi-bright-red"},{rgb:[0,255,0],class_name:"ansi-bright-green"},{rgb:[255,255,85],class_name:"ansi-bright-yellow"},{rgb:[85,85,255],class_name:"ansi-bright-blue"},{rgb:[255,85,255],class_name:"ansi-bright-magenta"},{rgb:[85,255,255],class_name:"ansi-bright-cyan"},{rgb:[255,255,255],class_name:"ansi-bright-white"}]],this.palette_256=[],this.ansi_colors.forEach(function(t){t.forEach(function(t){e.palette_256.push(t)})});for(var t=[0,95,135,175,215,255],n=0;n<6;++n)for(var i=0;i<6;++i)for(var s=0;s<6;++s){var r={rgb:[t[n],t[i],t[s]],class_name:"truecolor"};this.palette_256.push(r)}for(var a=8,l=0;l<24;++l,a+=10){var f={rgb:[a,a,a],class_name:"truecolor"};this.palette_256.push(f)}},e.prototype.escape_txt_for_html=function(e){return e.replace(/[&<>]/gm,function(e){return"&"===e?"&amp;":"<"===e?"&lt;":">"===e?"&gt;":void 0})},e.prototype.append_buffer=function(e){var t=this._buffer+e;this._buffer=t},e.prototype.get_next_packet=function(){var e={kind:t.EOS,text:"",url:""},i=this._buffer.length;if(0==i)return e;var r=this._buffer.indexOf("");if(-1==r)return e.kind=t.Text,e.text=this._buffer,this._buffer="",e;if(r>0)return e.kind=t.Text,e.text=this._buffer.slice(0,r),this._buffer=this._buffer.slice(r),e;if(0==r){if(1==i)return e.kind=t.Incomplete,e;var a=this._buffer.charAt(1);if("["!=a&&"]"!=a)return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if("["==a){if(this._csi_regex||(this._csi_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          [                      # CSI\n                          ([<-?]?)              # private-mode char\n                          ([d;]*)                    # any digits or semicolons\n                          ([ -/]?               # an intermediate modifier\n                          [@-~])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          [                      # CSI\n                          [ -~]*                # anything legal\n                          ([\0-:])              # anything illegal\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                                                    # First attempt\n                        (?:                         # legal sequence\n                          \\x1b\\[                      # CSI\n                          ([\\x3c-\\x3f]?)              # private-mode char\n                          ([\\d;]*)                    # any digits or semicolons\n                          ([\\x20-\\x2f]?               # an intermediate modifier\n                          [\\x40-\\x7e])                # the command\n                        )\n                        |                           # alternate (second attempt)\n                        (?:                         # illegal sequence\n                          \\x1b\\[                      # CSI\n                          [\\x20-\\x7e]*                # anything legal\n                          ([\\x00-\\x1f:])              # anything illegal\n                        )\n                    "]))),null===(h=this._buffer.match(this._csi_regex)))return e.kind=t.Incomplete,e;if(h[4])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;""!=h[1]||"m"!=h[3]?e.kind=t.Unknown:e.kind=t.SGR,e.text=h[2];var l=h[0].length;return this._buffer=this._buffer.slice(l),e}if("]"==a){if(i<4)return e.kind=t.Incomplete,e;if("8"!=this._buffer.charAt(2)||";"!=this._buffer.charAt(3))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;this._osc_st||(this._osc_st=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0],s=i.replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(s,"g")}(n(["\n                        (?:                         # legal sequence\n                          (\\)                    # ESC                           |                           # alternate\n                          ()                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\0-]                 # anything illegal\n                          |                           # alternate\n                          [\b-]                 # anything illegal\n                          |                           # alternate\n                          [-]                 # anything illegal\n                        )\n                    "],["\n                        (?:                         # legal sequence\n                          (\\x1b\\\\)                    # ESC \\\n                          |                           # alternate\n                          (\\x07)                      # BEL (what xterm did)\n                        )\n                        |                           # alternate (second attempt)\n                        (                           # illegal sequence\n                          [\\x00-\\x06]                 # anything illegal\n                          |                           # alternate\n                          [\\x08-\\x1a]                 # anything illegal\n                          |                           # alternate\n                          [\\x1c-\\x1f]                 # anything illegal\n                        )\n                    "]))),this._osc_st.lastIndex=0;var f=this._osc_st.exec(this._buffer);if(null===f)return e.kind=t.Incomplete,e;if(f[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;var h,o=this._osc_st.exec(this._buffer);if(null===o)return e.kind=t.Incomplete,e;if(o[3])return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;if(this._osc_regex||(this._osc_regex=s(n(["\n                        ^                           # beginning of line\n                                                    #\n                        ]8;                    # OSC Hyperlink\n                        [ -:<-~]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([!-~]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                        ([!-~]+)              # TEXT capture\n                        ]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\)                  # ESC                           |                           # alternate\n                          (?:)                    # BEL (what xterm did)\n                        )\n                    "],["\n                        ^                           # beginning of line\n                                                    #\n                        \\x1b\\]8;                    # OSC Hyperlink\n                        [\\x20-\\x3a\\x3c-\\x7e]*       # params (excluding ;)\n                        ;                           # end of params\n                        ([\\x21-\\x7e]{0,512})        # URL capture\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                        ([\\x21-\\x7e]+)              # TEXT capture\n                        \\x1b\\]8;;                   # OSC Hyperlink End\n                        (?:                         # ST\n                          (?:\\x1b\\\\)                  # ESC \\\n                          |                           # alternate\n                          (?:\\x07)                    # BEL (what xterm did)\n                        )\n                    "]))),null===(h=this._buffer.match(this._osc_regex)))return e.kind=t.ESC,e.text=this._buffer.slice(0,1),this._buffer=this._buffer.slice(1),e;e.kind=t.OSCURL,e.url=h[1],e.text=h[2];l=h[0].length;return this._buffer=this._buffer.slice(l),e}}},e.prototype.ansi_to_html=function(e){this.append_buffer(e);for(var n=[];;){var i=this.get_next_packet();if(i.kind==t.EOS||i.kind==t.Incomplete)break;i.kind!=t.ESC&&i.kind!=t.Unknown&&(i.kind==t.Text?n.push(this.transform_to_html(this.with_state(i))):i.kind==t.SGR?this.process_ansi(i):i.kind==t.OSCURL&&n.push(this.process_hyperlink(i)))}return n.join("")},e.prototype.with_state=function(e){return{bold:this.bold,fg:this.fg,bg:this.bg,text:e.text}},e.prototype.process_ansi=function(e){for(var t=e.text.split(";");t.length>0;){var n=t.shift(),i=parseInt(n,10);if(isNaN(i)||0===i)this.fg=this.bg=null,this.bold=!1;else if(1===i)this.bold=!0;else if(22===i)this.bold=!1;else if(39===i)this.fg=null;else if(49===i)this.bg=null;else if(i>=30&&i<38)this.fg=this.ansi_colors[0][i-30];else if(i>=40&&i<48)this.bg=this.ansi_colors[0][i-40];else if(i>=90&&i<98)this.fg=this.ansi_colors[1][i-90];else if(i>=100&&i<108)this.bg=this.ansi_colors[1][i-100];else if((38===i||48===i)&&t.length>0){var s=38===i,r=t.shift();if("5"===r&&t.length>0){var a=parseInt(t.shift(),10);a>=0&&a<=255&&(s?this.fg=this.palette_256[a]:this.bg=this.palette_256[a])}if("2"===r&&t.length>2){var l=parseInt(t.shift(),10),f=parseInt(t.shift(),10),h=parseInt(t.shift(),10);if(l>=0&&l<=255&&f>=0&&f<=255&&h>=0&&h<=255){var o={rgb:[l,f,h],class_name:"truecolor"};s?this.fg=o:this.bg=o}}}}},e.prototype.transform_to_html=function(e){var t=e.text;if(0===t.length)return t;if(this._escape_for_html&&(t=this.escape_txt_for_html(t)),!e.bold&&null===e.fg&&null===e.bg)return t;var n=[],i=[],s=e.fg,r=e.bg;e.bold&&n.push("font-weight:bold"),this._use_classes?(s&&("truecolor"!==s.class_name?i.push(s.class_name+"-fg"):n.push("color:rgb("+s.rgb.join(",")+")")),r&&("truecolor"!==r.class_name?i.push(r.class_name+"-bg"):n.push("background-color:rgb("+r.rgb.join(",")+")"))):(s&&n.push("color:rgb("+s.rgb.join(",")+")"),r&&n.push("background-color:rgb("+r.rgb+")"));var a="",l="";return i.length&&(a=' class="'+i.join(" ")+'"'),n.length&&(l=' style="'+n.join(";")+'"'),"<span"+l+a+">"+t+"</span>"},e.prototype.process_hyperlink=function(e){var t=e.url.split(":");return t.length<1?"":this._url_whitelist[t[0]]?'<a href="'+this.escape_txt_for_html(e.url)+'">'+this.escape_txt_for_html(e.text)+"</a>":""},e}();function s(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var i=e.raw[0].replace(/^\s+|\s+\n|\s*#[\s\S]*?\n|\n/gm,"");return new RegExp(i)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=i});
+//# sourceMappingURL=/sm/e54fac82455c5244f73ba6a437a8ca0fefeba655e9f1fae1535a2c5dad960c25.map
 
 Review comment:
   Since we've got a source map line in this file we should also include the ansi_up.js.map file for this release.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
mik-laj commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-571350816
 
 
   > I removed this functionality in order to support this feature
   
   Can you add a configuration option that will allow us to change this option?  Some people view logs using other tools that do not support ASCII escape sequence e.g. Stackdriver.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362795822
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   Hi.
   I fond the right location, in the static directory.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366244084
 
 

 ##########
 File path: airflow/contrib/kubernetes/pod_launcher.py
 ##########
 @@ -122,6 +122,8 @@ def _monitor_pod(self, pod, get_logs):
         if get_logs:
             logs = self.read_pod_logs(pod)
             for line in logs:
+                if isinstance(line, bytes):
+                    line = line.decode('utf-8').strip()
 
 Review comment:
   Yes, by default the pod_launcher return the pod log as a binary data, 
   The ANSI coloring for the kubernetes operator worked only after this change.
   There is no reason to stdout log as a binary string (aka b'log')

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365895285
 
 

 ##########
 File path: airflow/utils/log/logging_mixin.py
 ##########
 @@ -109,7 +110,10 @@ def _propagate_log(self, message):
         """
         Propagate message removing escape codes.
         """
-        self.logger.log(self.level, remove_escape_codes(message))
+        if conf.getboolean('core', 'colored_ui_logs'):
+            self.logger.log(self.level, message)
+        else:
+            self.logger.log(self.level, remove_escape_codes(message))
 
 Review comment:
   This is an option to the user, in the default case this new feature will be disabled, so we should ignore the ASCI carracters

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365592307
 
 

 ##########
 File path: airflow/utils/log/logging_mixin.py
 ##########
 @@ -109,7 +110,10 @@ def _propagate_log(self, message):
         """
         Propagate message removing escape codes.
         """
-        self.logger.log(self.level, remove_escape_codes(message))
+        if conf.getboolean('core', 'colored_ui_logs'):
+            self.logger.log(self.level, message)
+        else:
+            self.logger.log(self.level, remove_escape_codes(message))
 
 Review comment:
   If ASCI codes are handled properly in WebUI I don't think we need this case?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365956885
 
 

 ##########
 File path: airflow/utils/log/logging_mixin.py
 ##########
 @@ -109,7 +110,10 @@ def _propagate_log(self, message):
         """
         Propagate message removing escape codes.
         """
-        self.logger.log(self.level, remove_escape_codes(message))
+        if conf.getboolean('core', 'colored_ui_logs'):
+            self.logger.log(self.level, message)
+        else:
+            self.logger.log(self.level, remove_escape_codes(message))
 
 Review comment:
   Got it. I am just wondering if colored logs in ui shouldn't be default. @potiuk @mik-laj WDYT?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570886057
 
 
   > Does Airflow write escape characters in logs? It seems to me that these characters are deleted. https://github.com/apache/airflow/blob/master/airflow/utils/log/logging_mixin.py#L28-L33
   
   I removed this functionality in order to support this feature

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570168665
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=h1) Report
   > Merging [#6998](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=desc) into [v1-10-stable](https://codecov.io/gh/apache/airflow/commit/c8597cbf143b970ad3c7b0d62e3b44d1dfdc8afe?src=pr&el=desc) will **decrease** coverage by `0.2%`.
   > The diff coverage is `100%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/6998/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree)
   
   ```diff
   @@               Coverage Diff               @@
   ##           v1-10-stable   #6998      +/-   ##
   ===============================================
   - Coverage          81.5%   81.3%   -0.21%     
   ===============================================
     Files               526     526              
     Lines             36032   36032              
   ===============================================
   - Hits              29368   29295      -73     
   - Misses             6664    6737      +73
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/utils/log/logging\_mixin.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9sb2cvbG9nZ2luZ19taXhpbi5weQ==) | `95.4% <100%> (-1.15%)` | :arrow_down: |
   | [airflow/executors/sequential\_executor.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvc2VxdWVudGlhbF9leGVjdXRvci5weQ==) | `50% <0%> (-50%)` | :arrow_down: |
   | [airflow/utils/sqlalchemy.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9zcWxhbGNoZW15LnB5) | `90.47% <0%> (-6.35%)` | :arrow_down: |
   | [airflow/utils/dag\_processing.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9kYWdfcHJvY2Vzc2luZy5weQ==) | `86.52% <0%> (-5.52%)` | :arrow_down: |
   | [airflow/utils/helpers.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9oZWxwZXJzLnB5) | `75% <0%> (-5.19%)` | :arrow_down: |
   | [airflow/executors/\_\_init\_\_.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvX19pbml0X18ucHk=) | `78.84% <0%> (-1.93%)` | :arrow_down: |
   | [airflow/jobs/scheduler\_job.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9qb2JzL3NjaGVkdWxlcl9qb2IucHk=) | `88.74% <0%> (-1.17%)` | :arrow_down: |
   | [airflow/models/taskinstance.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvdGFza2luc3RhbmNlLnB5) | `93.53% <0%> (-0.49%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=footer). Last update [c8597cb...5d2f8e8](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r366298066
 
 

 ##########
 File path: airflow/www/static/ansi_up.min.js
 ##########
 @@ -0,0 +1,25 @@
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
 
 Review comment:
   I have a feeling that putting the apache/SAF license on this file is wrong. It is not licensed under the Apache license. You will need to work out how to update the license checkes to exclude this file 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r388254528
 
 

 ##########
 File path: airflow/config_templates/default_airflow.cfg
 ##########
 @@ -67,6 +67,9 @@ colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatte
 log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
 simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s
 
+# Colored logs in the WebUI (ANSI Colour)
+colored_ui_logs = False
 
 Review comment:
   @ashb, I dont have config.yml file in this path, should I create new file?
   
   ![image](https://user-images.githubusercontent.com/6237072/75980429-1d4afa80-5eeb-11ea-979d-f1f600fca886.png)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570168665
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=h1) Report
   > Merging [#6998](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=desc) into [v1-10-stable](https://codecov.io/gh/apache/airflow/commit/c8597cbf143b970ad3c7b0d62e3b44d1dfdc8afe?src=pr&el=desc) will **decrease** coverage by `0.2%`.
   > The diff coverage is `100%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/6998/graphs/tree.svg?width=650&token=WdLKlKHOAU&height=150&src=pr)](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree)
   
   ```diff
   @@               Coverage Diff               @@
   ##           v1-10-stable   #6998      +/-   ##
   ===============================================
   - Coverage          81.5%   81.3%   -0.21%     
   ===============================================
     Files               526     526              
     Lines             36032   36032              
   ===============================================
   - Hits              29368   29295      -73     
   - Misses             6664    6737      +73
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/utils/log/logging\_mixin.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9sb2cvbG9nZ2luZ19taXhpbi5weQ==) | `95.4% <100%> (-1.15%)` | :arrow_down: |
   | [airflow/executors/sequential\_executor.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvc2VxdWVudGlhbF9leGVjdXRvci5weQ==) | `50% <0%> (-50%)` | :arrow_down: |
   | [airflow/utils/sqlalchemy.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9zcWxhbGNoZW15LnB5) | `90.47% <0%> (-6.35%)` | :arrow_down: |
   | [airflow/utils/dag\_processing.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9kYWdfcHJvY2Vzc2luZy5weQ==) | `86.52% <0%> (-5.52%)` | :arrow_down: |
   | [airflow/utils/helpers.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy9oZWxwZXJzLnB5) | `75% <0%> (-5.19%)` | :arrow_down: |
   | [airflow/executors/\_\_init\_\_.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvX19pbml0X18ucHk=) | `78.84% <0%> (-1.93%)` | :arrow_down: |
   | [airflow/jobs/scheduler\_job.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9qb2JzL3NjaGVkdWxlcl9qb2IucHk=) | `88.74% <0%> (-1.17%)` | :arrow_down: |
   | [airflow/models/taskinstance.py](https://codecov.io/gh/apache/airflow/pull/6998/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvdGFza2luc3RhbmNlLnB5) | `93.53% <0%> (-0.49%)` | :arrow_down: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=footer). Last update [c8597cb...5d2f8e8](https://codecov.io/gh/apache/airflow/pull/6998?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] nuclearpinguin commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
nuclearpinguin commented on issue #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#issuecomment-570215993
 
 
   @ohadmata do this and https://github.com/apache/airflow/pull/6823 PRs address the same issue?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362526965
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   I tested the change in a local environment with ansi_up and it's working like a magic :-)
   The problem is that I don't know where I should inclute the new js file.
   Some help please 
   
   Edit: I see that other resource file store in: /admin/admin/vendor
   But I cant find it in the source code :-(

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r365896143
 
 

 ##########
 File path: airflow/hooks/http_hook.py
 ##########
 @@ -142,8 +144,13 @@ def check_response(self, response):
         try:
             response.raise_for_status()
         except requests.exceptions.HTTPError:
-            self.log.error("HTTP error: %s", response.reason)
-            self.log.error(response.text)
+            # mark the exception if colored log is supported
+            if conf.getboolean('core', 'colored_ui_logs'):
+                self.log.error(Fore.WHITE + Back.RED + "HTTP error: %s", response.reason + Style.RESET_ALL)
+                self.log.error(Fore.WHITE + Back.RED + response.text + Style.RESET_ALL)
 
 Review comment:
   I don't understand. where is this color log formatter?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r372656745
 
 

 ##########
 File path: airflow/config_templates/default_airflow.cfg
 ##########
 @@ -67,6 +67,9 @@ colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatte
 log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
 simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s
 
+# Colored logs in the WebUI (ANSI Colour)
+colored_ui_logs = False
 
 Review comment:
   You still haven't done this change.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services