@@ -389,25 +389,7 @@ def status(self) -> str:
389389 """Return current status of :class:`Job`."""
390390 if self .load_if_cached :
391391 return "success"
392- if web ._is_modeler_batch (self .task_id ):
393- detail = self .get_info ()
394- status = detail .totalStatus .value
395- return status
396- else :
397- return self .get_info ().status
398-
399- @property
400- def postprocess_status (self ) -> Optional [str ]:
401- """Return current postprocess status of :class:`Job` if it is a Component Modeler."""
402- if web ._is_modeler_batch (self .task_id ):
403- detail = self .get_info ()
404- return detail .postprocessStatus
405- else :
406- log .warning (
407- f"Task ID '{ self .task_id } ' is not a modeler batch job. "
408- "'postprocess_start' is only applicable to Component Modelers"
409- )
410- return
392+ return self .get_info ().status
411393
412394 def start (self , priority : Optional [int ] = None ) -> None :
413395 """Start running a :class:`Job`.
@@ -548,37 +530,6 @@ def estimate_cost(self, verbose: bool = True) -> float:
548530 return 0.0
549531 return web .estimate_cost (self .task_id , verbose = verbose , solver_version = self .solver_version )
550532
551- def postprocess_start (self , worker_group : Optional [str ] = None , verbose : bool = True ) -> None :
552- """
553- If the job is a modeler batch, checks if the run is complete and starts
554- the postprocess phase.
555-
556- This function does not wait for postprocessing to finish and is only
557- applicable to Component Modeler batch jobs.
558-
559- Parameters
560- ----------
561- worker_group : Optional[str] = None
562- The specific worker group to run the postprocessing task on.
563- verbose : bool = True
564- Whether to print info messages. This overrides the Job's 'verbose' setting for this call.
565- """
566- # First, confirm that the task is a modeler batch job.
567- if not web ._is_modeler_batch (self .task_id ):
568- # If not, inform the user and exit.
569- # This warning is important and should not be suppressed.
570- log .warning (
571- f"Task ID '{ self .task_id } ' is not a modeler batch job. "
572- "'postprocess_start' is only applicable to Component Modelers"
573- )
574- return
575-
576- # If it is a modeler batch, call the dedicated function to start postprocessing.
577- # The verbosity is a combination of the job's setting and the method's parameter.
578- web .postprocess_start (
579- batch_id = self .task_id , verbose = (self .verbose and verbose ), worker_group = worker_group
580- )
581-
582533 @staticmethod
583534 def _check_path_dir (path : PathLike ) -> None :
584535 """Make sure parent directory of ``path`` exists and create it if not.
@@ -1043,21 +994,6 @@ def get_run_info(self) -> dict[TaskName, RunInfo]:
1043994 run_info_dict [task_name ] = run_info
1044995 return run_info_dict
1045996
1046- def postprocess_start (self , worker_group : Optional [str ] = None , verbose : bool = True ) -> None :
1047- """
1048- Start the postprocess phase for all applicable jobs in the batch.
1049-
1050- This simply forwards to each Job's `postprocess_start(...)`. The Job decides
1051- whether it's a Component Modeler task and whether it can/should start now.
1052- This method does not wait for postprocessing to finish.
1053- """
1054- if self .verbose and verbose :
1055- console = get_logging_console ()
1056- console .log ("Attempting to start postprocessing for jobs in the batch." )
1057-
1058- for job in self .jobs .values ():
1059- job .postprocess_start (worker_group = worker_group , verbose = verbose )
1060-
1061997 def monitor (
1062998 self ,
1063999 * ,
@@ -1069,7 +1005,6 @@ def monitor(
10691005 """
10701006 Monitor progress of each running task.
10711007
1072- - For Component Modeler jobs, automatically triggers postprocessing once run finishes.
10731008 - Optionally downloads results as soon as a job reaches final success.
10741009 - Rich progress bars in verbose mode; quiet polling otherwise.
10751010
@@ -1095,16 +1030,8 @@ def monitor(
10951030 self ._check_path_dir (path_dir = path_dir )
10961031 download_executor = ThreadPoolExecutor (max_workers = self .num_workers )
10971032
1098- def _should_download (job : Job ) -> bool :
1099- status = job .status
1100- if not web ._is_modeler_batch (job .task_id ):
1101- return status == "success"
1102- if status == "success" :
1103- return True
1104- return status == "run_success" and getattr (job , "postprocess_status" , None ) == "success"
1105-
11061033 def schedule_download (job : Job ) -> None :
1107- if download_executor is None or not _should_download ( job ) :
1034+ if download_executor is None or job . status not in COMPLETED_STATES :
11081035 return
11091036 task_id = job .task_id
11101037 if task_id in downloads_started :
@@ -1128,12 +1055,7 @@ def schedule_download(job: Job) -> None:
11281055 def check_continue_condition (job : Job ) -> bool :
11291056 if job .load_if_cached :
11301057 return False
1131- status = job .status
1132- if not web ._is_modeler_batch (job .task_id ):
1133- return status not in END_STATES
1134- if status == "run_success" :
1135- return job .postprocess_status not in END_STATES
1136- return status not in END_STATES
1058+ return job .status not in END_STATES
11371059
11381060 def pbar_description (
11391061 task_name : str , status : str , max_name_length : int , status_width : int
@@ -1157,9 +1079,6 @@ def pbar_description(
11571079 max_task_name = max (len (task_name ) for task_name in self .jobs .keys ())
11581080 max_name_length = min (30 , max (max_task_name , 15 ))
11591081
1160- # track which modeler jobs we've already kicked into postprocess
1161- postprocess_started_tasks : set [str ] = set ()
1162-
11631082 try :
11641083 console = None
11651084 progress_columns = []
@@ -1195,17 +1114,6 @@ def pbar_description(
11951114 for task_name , job in self .jobs .items ():
11961115 status = job .status
11971116
1198- # auto-start postprocess for modeler jobs when run finishes
1199- if (
1200- web ._is_modeler_batch (job .task_id )
1201- and status == "run_success"
1202- and job .task_id not in postprocess_started_tasks
1203- ):
1204- job .postprocess_start (
1205- worker_group = postprocess_worker_group , verbose = True
1206- )
1207- postprocess_started_tasks .add (job .task_id )
1208-
12091117 schedule_download (job )
12101118
12111119 if self .verbose :
0 commit comments