potix2 commented on a change in pull request #11531:
URL: https://github.com/apache/airflow/pull/11531#discussion_r505800924
##########
File path: airflow/providers/amazon/aws/hooks/sagemaker.py
##########
@@ -105,22 +107,14 @@ def secondary_training_status_message(job_description,
prev_description):
:return: Job status string to be printed.
"""
- if (
- job_description is None
- or job_description.get('SecondaryStatusTransitions') is None
- or len(job_description.get('SecondaryStatusTransitions')) == 0
- ):
+ current_transitions = job_description.get('SecondaryStatusTransitions')
+ if current_transitions is None or len(current_transitions) == 0:
return ''
- prev_description_secondary_transitions = (
- prev_description.get('SecondaryStatusTransitions') if prev_description
is not None else None
- )
- prev_transitions_num = (
- len(prev_description['SecondaryStatusTransitions'])
- if prev_description_secondary_transitions is not None
- else 0
- )
- current_transitions = job_description['SecondaryStatusTransitions']
+ prev_transitions_num = 0
Review comment:
To avoid deeply nested if-statements I rearrange the order of 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:
[email protected]