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

Commit af70b2e

Browse files
committed
Only warn about scheduling once in verbose job output
1 parent 0b1c2ff commit af70b2e

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
@@ -287,6 +287,8 @@ def print_job(client, job: models.Job, apps: bool):
287287
if apps:
288288
print_applications(applications)
289289
log.info("")
290+
else:
291+
warn_scheduling(applications)
290292

291293

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

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

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

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

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

344-
warn_scheduling = False
345350
for name, application in applications.items():
346351
if application is None:
347352
log.info(
@@ -352,7 +357,6 @@ def print_applications(applications: Dict[str, models.Application]):
352357
"-"
353358
)
354359
)
355-
warn_scheduling = True
356360
else:
357361
log.info(
358362
print_format.format(
@@ -362,8 +366,7 @@ def print_applications(applications: Dict[str, models.Application]):
362366
application.exit_code if application.exit_code is not None else "-"
363367
)
364368
)
365-
if warn_scheduling:
366-
log.warning("\nNo Spark applications will be scheduled until the master is selected.")
369+
warn_scheduling(applications)
367370

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

0 commit comments

Comments
 (0)