Skip to content

Commit

Permalink
[AIRFLOW-5284] Replace warn by warning (#5881)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko authored and kaxil committed Aug 22, 2019
1 parent 5196db3 commit 6344bb9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions airflow/contrib/example_dags/example_kubernetes_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
)

except ImportError as e:
log.warn("Could not import KubernetesPodOperator: " + str(e))
log.warn("Install kubernetes dependencies with: "
" pip install 'apache-airflow[kubernetes]'")
log.warning("Could not import KubernetesPodOperator: " + str(e))
log.warning("Install kubernetes dependencies with: "
" pip install 'apache-airflow[kubernetes]'")
4 changes: 2 additions & 2 deletions airflow/contrib/utils/gcp_field_sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ def _sanitize(self, dictionary, remaining_field_spec, current_path):
elif isinstance(child, list):
for index, elem in enumerate(child):
if not isinstance(elem, dict):
self.log.warn(
self.log.warning(
"The field %s element at index %s is of wrong type. "
"It should be dict and is %s. Skipping it.",
current_path, index, elem)
self._sanitize(elem, remaining_path, "{}.{}[{}]".format(
current_path, field_name, index))
else:
self.log.warn(
self.log.warning(
"The field %s is of wrong type. It should be dict or list and it is %s. Skipping it.",
current_path, child
)
Expand Down
12 changes: 6 additions & 6 deletions airflow/executors/kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ def run(self):
self.log.exception('Unknown error in KubernetesJobWatcher. Failing')
raise
else:
self.log.warn('Watch died gracefully, starting back up with: '
'last resource_version: %s', self.resource_version)
self.log.warning('Watch died gracefully, starting back up with: '
'last resource_version: %s', self.resource_version)

def _run(self, kube_client, resource_version, worker_uuid, kube_config):
self.log.info(
Expand Down Expand Up @@ -390,7 +390,7 @@ def process_status(self, pod_id, status, labels, resource_version):
elif status == 'Running':
self.log.info('Event: %s is Running', pod_id)
else:
self.log.warn(
self.log.warning(
'Event: Invalid state: %s on pod: %s with labels: %s with '
'resource_version: %s', status, pod_id, labels, resource_version
)
Expand Down Expand Up @@ -590,14 +590,14 @@ def _labels_to_key(self, labels):
try:
try_num = int(labels.get('try_number', '1'))
except ValueError:
self.log.warn("could not get try_number as an int: %s", labels.get('try_number', '1'))
self.log.warning("could not get try_number as an int: %s", labels.get('try_number', '1'))

try:
dag_id = labels['dag_id']
task_id = labels['task_id']
ex_time = self._label_safe_datestring_to_datetime(labels['execution_date'])
except Exception as e:
self.log.warn(
self.log.warning(
'Error while retrieving labels; labels: %s; exception: %s',
labels, e
)
Expand Down Expand Up @@ -626,7 +626,7 @@ def _labels_to_key(self, labels):
dag_id = task.dag_id
task_id = task.task_id
return (dag_id, task_id, ex_time, try_num)
self.log.warn(
self.log.warning(
'Failed to find and match task details to a pod; labels: %s',
labels
)
Expand Down
8 changes: 4 additions & 4 deletions airflow/hooks/dbapi_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ def set_autocommit(self, conn, autocommit):
Sets the autocommit flag on the connection
"""
if not self.supports_autocommit and autocommit:
self.log.warn(
("%s connection doesn't support "
"autocommit but autocommit activated."),
getattr(self, self.conn_name_attr))
self.log.warning(
"%s connection doesn't support autocommit but autocommit activated.",
getattr(self, self.conn_name_attr)
)
conn.autocommit = autocommit

def get_autocommit(self, conn):
Expand Down
2 changes: 1 addition & 1 deletion airflow/hooks/http_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def run_and_check(self, session, prepped_request, extra_options):
return response

except requests.exceptions.ConnectionError as ex:
self.log.warn(str(ex) + ' Tenacity will retry to execute the operation')
self.log.warning(str(ex) + ' Tenacity will retry to execute the operation')
raise ex

def run_with_advanced_retry(self, _retry_args, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/dag_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ def end(self):
:return:
"""
if not self._process:
self.log.warn('Ending without manager process.')
self.log.warning('Ending without manager process.')
return
reap_process_group(self._process.pid, log=self.log)
self._parent_signal_conn.close()
Expand Down
2 changes: 1 addition & 1 deletion airflow/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def on_terminate(p):

if alive:
for p in alive:
log.warn("process %s (%s) did not respond to SIGTERM. Trying SIGKILL", p, pid)
log.warning("process %s (%s) did not respond to SIGTERM. Trying SIGKILL", p, pid)

try:
os.killpg(os.getpgid(pid), signal.SIGKILL)
Expand Down

0 comments on commit 6344bb9

Please sign in to comment.