dlamblin commented on a change in pull request #4163: [AIRFLOW-3319] -
KubernetsExecutor: Need in try_number in labels if getting them later
URL: https://github.com/apache/incubator-airflow/pull/4163#discussion_r240277825
##########
File path: airflow/contrib/executors/kubernetes_executor.py
##########
@@ -458,10 +459,16 @@ def _datetime_to_label_safe_datestring(datetime_obj):
def _labels_to_key(self, labels):
try:
+ try_num = 1
+ 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'))
return (
labels['dag_id'], labels['task_id'],
self._label_safe_datestring_to_datetime(labels['execution_date']),
- labels['try_number'])
+ try_num
Review comment:
So, if you upgrade a live system any pods without the label will return
`try_num` 1. That's the crux of the fix (along with adding the try num label to
new pods made), right?
Would be a spot for a pep8 recommended (plays nice with vcs) redundant comma
```suggestion
try_num,
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services