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.
start lgacy client and integration tests
- Loading branch information
Showing
5 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
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
34 changes: 34 additions & 0 deletions
34
src/DIRAC/WorkloadManagementSystem/FutureClient/JobMonitoringClient.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,34 @@ | ||
from diracx.client import Dirac | ||
from diracx.client.models import JobSearchParams | ||
|
||
from diracx.cli.utils import get_auth_headers | ||
|
||
from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue | ||
|
||
|
||
def fetch(parameters, jobIDs): | ||
# breakpoint() | ||
with Dirac(endpoint="http://localhost:8000") as api: | ||
jobs = api.jobs.search( | ||
parameters=["JobID"] + parameters, | ||
search=[{"parameter": "JobID", "operator": "in", "values": jobIDs}], | ||
headers=get_auth_headers(), | ||
) | ||
return {j["JobID"]: {param: j[param] for param in parameters} for j in jobs} | ||
|
||
|
||
class JobMonitoringClient: | ||
def __init__(self, *args, **kwargs): | ||
"""TODO""" | ||
|
||
@convertToReturnValue | ||
def getJobsMinorStatus(self, jobIDs): | ||
return fetch(["MinorStatus"], jobIDs) | ||
|
||
@convertToReturnValue | ||
def getJobsStates(self, jobIDs): | ||
return fetch(["Status", "MinorStatus", "ApplicationStatus"], jobIDs) | ||
|
||
@convertToReturnValue | ||
def getJobsSites(self, jobIDs): | ||
return fetch(["Site"], jobIDs) |
Empty file.
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