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

Commit 3fac604

Browse files
committed
Only warn about scheduling once in verbose job output
1 parent 95c0b00 commit 3fac604

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

aztk_cli/utils.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def print_job(client, job: models.Job, apps: bool):
286286
if apps:
287287
print_applications(applications)
288288
log.info("")
289+
else:
290+
warn_scheduling(applications)
289291

290292

291293
def node_state_count(cluster: models.Cluster):
@@ -315,12 +317,9 @@ def application_summary(applications: Dict[str, models.Application]):
315317
for state in batch_models.TaskState:
316318
states[state.name] = 0
317319

318-
warn_scheduling = False
319-
320320
for name, application in applications.items():
321321
if application is None:
322322
states["scheduling"] += 1
323-
warn_scheduling = True
324323
else:
325324
states[application.state] += 1
326325

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

334-
if warn_scheduling:
333+
334+
def warn_scheduling(applications: Dict[str, models.Application]):
335+
warn = False
336+
for application in applications.values():
337+
if application is None:
338+
warn = True
339+
break
340+
if warn:
335341
log.warning("\nNo Spark applications will be scheduled until the master is selected.")
336342

337343
def print_applications(applications: Dict[str, models.Application]):
@@ -340,7 +346,6 @@ def print_applications(applications: Dict[str, models.Application]):
340346
log.info(print_format.format("Applications", "State", "Transition Time", "Exit Code"))
341347
log.info(print_format_underline.format('', '', '', ''))
342348

343-
warn_scheduling = False
344349
for name, application in applications.items():
345350
if application is None:
346351
log.info(
@@ -351,7 +356,6 @@ def print_applications(applications: Dict[str, models.Application]):
351356
"-"
352357
)
353358
)
354-
warn_scheduling = True
355359
else:
356360
log.info(
357361
print_format.format(
@@ -361,8 +365,7 @@ def print_applications(applications: Dict[str, models.Application]):
361365
application.exit_code if application.exit_code is not None else "-"
362366
)
363367
)
364-
if warn_scheduling:
365-
log.warning("\nNo Spark applications will be scheduled until the master is selected.")
368+
warn_scheduling(applications)
366369

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

0 commit comments

Comments
 (0)