Skip to content

Commit

Permalink
[AIRFLOW-2034] Fix mixup between %s and {} when using str.format
Browse files Browse the repository at this point in the history
Convention is to use .format for string formating oustide logging, else use lazy format
See comment in related issue
https://github.com/apache/incubator-airflow/pull/2823/files
Identified problematic case using following command line
.git/COMMIT_EDITMSG:`grep -r '%s'./* | grep '\.format('`

Closes apache#2976 from knil-sama/fix-mixup-format-str
  • Loading branch information
knil-sama authored and bolkedebruin committed Feb 25, 2018
1 parent caa8fd9 commit 6efe2e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion airflow/hooks/slack_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def call(self, method, api_params):
rc = sc.api_call(method, **api_params)

if not rc['ok']:
msg = "Slack API call failed (%s)".format(rc['error'])
msg = "Slack API call failed ({})".format(rc['error'])
raise AirflowException(msg)
6 changes: 3 additions & 3 deletions airflow/task/task_runner/base_task_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ def _read_task_logs(self, stream):
line = line.decode('utf-8')
if len(line) == 0:
break
self.log.info(u'Job {}: Subtask {} %s'.format(
self._task_instance.job_id, self._task_instance.task_id),
line.rstrip('\n'))
self.log.info('Job %s: Subtask %s %s',
self._task_instance.job_id, self._task_instance.task_id,
line.rstrip('\n'))

def run_command(self, run_with, join_args=False):
"""
Expand Down

0 comments on commit 6efe2e3

Please sign in to comment.