forked from DIRACGrid/DIRAC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce the JobExecutionCoordinator
- Loading branch information
Showing
3 changed files
with
109 additions
and
46 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/DIRAC/WorkloadManagementSystem/JobWrapper/JobExecutionCoordinator.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from DIRAC import S_OK | ||
|
||
|
||
class JobExecutionCoordinator: | ||
""" | ||
Abstract class for job execution coordinators. | ||
This class is responsible for pre-processing and post-processing jobs before and after execution. | ||
It should be implemented by the community job execution coordinator. | ||
It is used by the JobWrapper to handle the execution of jobs. | ||
""" | ||
|
||
def __init__(self, jobArgs: dict, ceArgs: dict) -> None: | ||
""" | ||
Initialize the job execution coordinator. | ||
:param jobArgs: The job arguments | ||
:param ceArgs: The environment arguments | ||
""" | ||
self.jobArgs = jobArgs | ||
self.ceArgs = ceArgs | ||
|
||
def preProcess(self, command: str, exeEnv: dict): | ||
""" | ||
Pre-process a job before executing it. | ||
This should handle tasks like downloading inputs, preparing commands, etc. | ||
:param job: The job to be pre-processed | ||
""" | ||
return S_OK({"command": command, "env": exeEnv}) | ||
|
||
def postProcess(self): | ||
""" | ||
Post-process a job after executing it. | ||
This should handle tasks like uploading outputs, checking results, etc. | ||
:param job: The job to be post-processed | ||
""" | ||
return S_OK() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.