@@ -455,84 +455,51 @@ def submit(event, update, dryrun):
455455 production .status = "running"
456456 else :
457457 pipe = production .pipeline
458- # check the priority status to see if we need to start
459- # the analysis
460- to_analyse = True
461- if production .status not in {"ready" }:
462- to_analyse = False
463- else :
464- # verify priority method to be used
465- priority_method = check_priority_method (production )
466- if priority_method == "vanilla" :
467- N_ok = 0
468- for prod in production ._needs :
469- if interest_dict_single_analysis [production .event .name ][prod ]['done' ]:
470- N_ok += 1
471- if N_ok < len (production ._needs ):
472- to_analyse = False
473- elif priority_method == "is_interesting" :
474- if "minimum" in production .meat ["needs settings" ].keys ():
475- N_target = int (production .meta ["needs settings" ]["minimum" ])
476- else :
477- # all pipelines should indicate the run as interesting
478- N_target = len (production ._needs )
479- for prod in production ._needs :
480- if interest_dict_single_analysis [production .event .name ][prod ]['interest status' ]:
481- N_ok += 1
482- if N_ok < N_target :
483- to_analyse = False
484- else :
485- raise ValueError (f"Priority method { priority_method } not recognized" )
486- if to_analyse :
487- try :
488- pipe .build_dag (dryrun = dryrun )
489- except PipelineException as e :
490- logger .error (
491- "failed to build a DAG file." ,
492- )
493- logger .exception (e )
494- click .echo (
495- click .style ("●" , fg = "red" )
496- + f" Unable to submit { production .name } "
497- )
498- except ValueError :
499- logger .info ("Unable to submit an unbuilt production" )
458+
459+ try :
460+ pipe .build_dag (dryrun = dryrun )
461+ except PipelineException as e :
462+ logger .error (
463+ "failed to build a DAG file." ,
464+ )
465+ logger .exception (e )
466+ click .echo (
467+ click .style ("●" , fg = "red" )
468+ + f" Unable to submit { production .name } "
469+ )
470+ except ValueError :
471+ logger .info ("Unable to submit an unbuilt production" )
472+ click .echo (
473+ click .style ("●" , fg = "red" )
474+ + f" Unable to submit { production .name } as it hasn't been built yet."
475+ )
476+ click .echo ("Try running `asimov manage build` first." )
477+ try :
478+ pipe .submit_dag (dryrun = dryrun )
479+ if not dryrun :
500480 click .echo (
501- click .style ("●" , fg = "red " )
502- + f" Unable to submit { production .name } as it hasn't been built yet. "
481+ click .style ("●" , fg = "green " )
482+ + f" Submitted { production .event . name } / { production . name } "
503483 )
504- click .echo ("Try running `asimov manage build` first." )
505- try :
506- pipe .submit_dag (dryrun = dryrun )
507- if not dryrun :
508- click .echo (
509- click .style ("●" , fg = "green" )
510- + f" Submitted { production .event .name } /{ production .name } "
511- )
512- production .status = "running"
484+ production .status = "running"
513485
514- except PipelineException as e :
515- production .status = "stuck"
516- click .echo (
517- click .style ("●" , fg = "red" )
518- + f" Unable to submit { production .name } "
519- )
520- logger .exception (e )
521- ledger .update_event (event )
522- logger .error (
523- f"The pipeline failed to submit the DAG file to the cluster. { e } " ,
524- )
525- if not dryrun :
526- # Refresh the job list
527- job_list = condor .CondorJobList ()
528- job_list .refresh ()
529- # Update the ledger
530- ledger .update_event (event )
531- else :
486+ except PipelineException as e :
487+ production .status = "stuck"
532488 click .echo (
533- click .style ("●" , fg = "yellow " )
534- + f"Production { production .name } not ready to submit "
489+ click .style ("●" , fg = "red " )
490+ + f" Unable to submit { production .name } "
535491 )
492+ logger .exception (e )
493+ ledger .update_event (event )
494+ logger .error (
495+ f"The pipeline failed to submit the DAG file to the cluster. { e } " ,
496+ )
497+ if not dryrun :
498+ # Refresh the job list
499+ job_list = condor .CondorJobList ()
500+ job_list .refresh ()
501+ # Update the ledger
502+ ledger .update_event (event )
536503
537504@click .option (
538505 "--event" ,
0 commit comments