@@ -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
292294def 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 ("\n No Spark applications will be scheduled until the master is selected." )
337343
338344def 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 ("\n No Spark applications will be scheduled until the master is selected." )
369+ warn_scheduling (applications )
367370
368371def print_application (application : models .Application ):
369372 print_format = '{:<30}| {:<15}'
0 commit comments