@@ -274,6 +274,8 @@ def print_job(client, job: models.Job, apps: bool):
274274 if apps :
275275 print_applications (applications )
276276 log .info ("" )
277+ else :
278+ warn_scheduling (applications )
277279
278280
279281def node_state_count (cluster : models .Cluster ):
@@ -303,12 +305,9 @@ def application_summary(applications: Dict[str, models.Application]):
303305 for state in batch_models .TaskState :
304306 states [state .name ] = 0
305307
306- warn_scheduling = False
307-
308308 for name , application in applications .items ():
309309 if application is None :
310310 states ["scheduling" ] += 1
311- warn_scheduling = True
312311 else :
313312 states [application .state ] += 1
314313
@@ -319,7 +318,14 @@ def application_summary(applications: Dict[str, models.Application]):
319318 if states [state ] > 0 :
320319 log .info (print_format .format (state + ":" , states [state ]))
321320
322- if warn_scheduling :
321+
322+ def warn_scheduling (applications : Dict [str , models .Application ]):
323+ warn = False
324+ for application in applications .values ():
325+ if application is None :
326+ warn = True
327+ break
328+ if warn :
323329 log .warning ("\n No Spark applications will be scheduled until the master is selected." )
324330
325331def print_applications (applications : Dict [str , models .Application ]):
@@ -328,7 +334,6 @@ def print_applications(applications: Dict[str, models.Application]):
328334 log .info (print_format .format ("Applications" , "State" , "Transition Time" , "Exit Code" ))
329335 log .info (print_format_underline .format ('' , '' , '' , '' ))
330336
331- warn_scheduling = False
332337 for name , application in applications .items ():
333338 if application is None :
334339 log .info (
@@ -339,7 +344,6 @@ def print_applications(applications: Dict[str, models.Application]):
339344 "-"
340345 )
341346 )
342- warn_scheduling = True
343347 else :
344348 log .info (
345349 print_format .format (
@@ -349,8 +353,7 @@ def print_applications(applications: Dict[str, models.Application]):
349353 application .exit_code if application .exit_code is not None else "-"
350354 )
351355 )
352- if warn_scheduling :
353- log .warning ("\n No Spark applications will be scheduled until the master is selected." )
356+ warn_scheduling (applications )
354357
355358def print_application (application : models .Application ):
356359 print_format = '{:<30}| {:<15}'
0 commit comments