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 Mar 28, 2018
1 parent cad0b74 commit 9091d31
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 @@ -274,6 +274,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 @@ -303,12 +305,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 @@ -319,7 +318,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 @@ -328,7 +334,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 @@ -339,7 +344,6 @@ def print_applications(applications: Dict[str, models.Application]):
"-"
)
)
warn_scheduling = True
else:
log.info(
print_format.format(
Expand All @@ -349,8 +353,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 9091d31

Please sign in to comment.