Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Commit

Permalink
Only warn about scheduling once in verbose job output
Browse files Browse the repository at this point in the history
  • Loading branch information
emlyn committed May 31, 2018
1 parent 0b1c2ff commit af70b2e
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions aztk_cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ def print_job(client, job: models.Job, apps: bool):
if apps:
print_applications(applications)
log.info("")
else:
warn_scheduling(applications)


def node_state_count(cluster: models.Cluster):
Expand Down Expand Up @@ -316,12 +318,9 @@ def application_summary(applications: Dict[str, models.Application]):
for state in batch_models.TaskState:
states[state.name] = 0

warn_scheduling = False

for name, application in applications.items():
if application is None:
states["scheduling"] += 1
warn_scheduling = True
else:
states[application.state] += 1

Expand All @@ -332,7 +331,14 @@ def application_summary(applications: Dict[str, models.Application]):
if states[state] > 0:
log.info(print_format.format(state + ":", states[state]))

if warn_scheduling:

def warn_scheduling(applications: Dict[str, models.Application]):
warn = False
for application in applications.values():
if application is None:
warn = True
break
if warn:
log.warning("\nNo Spark applications will be scheduled until the master is selected.")

def print_applications(applications: Dict[str, models.Application]):
Expand All @@ -341,7 +347,6 @@ def print_applications(applications: Dict[str, models.Application]):
log.info(print_format.format("Applications", "State", "Transition Time", "Exit Code"))
log.info(print_format_underline.format('', '', '', ''))

warn_scheduling = False
for name, application in applications.items():
if application is None:
log.info(
Expand All @@ -352,7 +357,6 @@ def print_applications(applications: Dict[str, models.Application]):
"-"
)
)
warn_scheduling = True
else:
log.info(
print_format.format(
Expand All @@ -362,8 +366,7 @@ def print_applications(applications: Dict[str, models.Application]):
application.exit_code if application.exit_code is not None else "-"
)
)
if warn_scheduling:
log.warning("\nNo Spark applications will be scheduled until the master is selected.")
warn_scheduling(applications)

def print_application(application: models.Application):
print_format = '{:<30}| {:<15}'
Expand Down

0 comments on commit af70b2e

Please sign in to comment.