1919T = TypeVar ("T" , bound = "SchedulingHint" )
2020
2121
22- class ExecutionHooks (ABC ):
23- """Abstract base class for execution hooks.
24-
25- This class defines the interface for pre/post processing operations
26- that can be performed during job execution.
27- """
28-
29- @abstractmethod
30- def pre_process (self , job_path : Path , command : List [str ]) -> List [str ]:
31- """Pre-process job inputs and command.
32-
33- Parameters
34- ----------
35- job_path : Path
36- Path to the job working directory.
37- command : List[str]
38- The command to be executed.
39-
40- Returns
41- -------
42- List[str]
43- Modified command list.
44- """
45- pass
46-
47- @abstractmethod
48- def post_process (self , job_path : Path ) -> bool :
49- """Post-process job outputs.
50-
51- Parameters
52- ----------
53- job_path : Path
54- Path to the job working directory.
55-
56- Returns
57- -------
58- bool
59- True if post-processing succeeded, False otherwise.
60- """
61- pass
62-
63-
6422class DataCatalogInterface (ABC ):
6523 """Abstract interface for data catalog operations."""
6624
@@ -120,8 +78,8 @@ def store_output(self, output_name: str, src_path: str) -> None:
12078 logger .info (f"Output { output_name } stored in { dest } " )
12179
12280
123- class TaskRuntimeBasePlugin (BaseModel , DataCatalogInterface , ExecutionHooks ):
124- """Base class for all runtime plugin models.
81+ class ExecutionHooksBasePlugin (BaseModel , DataCatalogInterface ):
82+ """Base class for all runtime plugin models with execution hooks .
12583
12684 This class combines Pydantic validation with the execution hooks
12785 and data catalog interfaces to provide a complete foundation for runtime plugin implementations.
@@ -151,12 +109,33 @@ def get_metadata_class(cls) -> str:
151109 name = name [:- 8 ] # Remove "Metadata" suffix
152110 return name
153111
154- def pre_process (self , job_path : Path , command : List [str ]) -> List [str ]:
155- """Default pre-processing: return command unchanged."""
112+ def pre_process (
113+ self , job_path : Path , command : List [str ], ** kwargs : Any
114+ ) -> List [str ]:
115+ """Pre-process job inputs and command.
116+
117+ Parameters
118+ ----------
119+ job_path : Path
120+ Path to the job working directory.
121+ command : List[str]
122+ The command to be executed.
123+
124+ Returns
125+ -------
126+ List[str]
127+ Modified command list.
128+ """
156129 return command
157130
158- def post_process (self , job_path : Path ) -> bool :
159- """Default post-processing: always succeed."""
131+ def post_process (self , job_path : Path , ** kwargs : Any ) -> bool :
132+ """Post-process job outputs.
133+
134+ Parameters
135+ ----------
136+ job_path : Path
137+ Path to the job working directory.
138+ """
160139 return True
161140
162141 def get_input_query (
@@ -284,11 +263,11 @@ def model_copy(
284263
285264 return super ().model_copy (update = merged_update , deep = deep )
286265
287- def to_runtime (self , submitted : Optional [Any ] = None ) -> "TaskRuntimeBasePlugin " :
266+ def to_runtime (self , submitted : Optional [Any ] = None ) -> "ExecutionHooksBasePlugin " :
288267 """
289268 Build and instantiate the runtime metadata implementation.
290269
291- The returned object is an instance of :class:`TaskRuntimeBasePlugin ` created
270+ The returned object is an instance of :class:`ExecutionHooksBasePlugin ` created
292271 by the metadata registry. The instantiation parameters are constructed
293272 by merging, in order:
294273
@@ -308,7 +287,7 @@ def to_runtime(self, submitted: Optional[Any] = None) -> "TaskRuntimeBasePlugin"
308287
309288 Returns
310289 -------
311- TaskRuntimeBasePlugin
290+ ExecutionHooksBasePlugin
312291 Runtime plugin implementation instantiated from the registry.
313292 """
314293 # Import here to avoid circular imports
0 commit comments