-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
59 additions
and
42 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
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
51 changes: 25 additions & 26 deletions
51
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 |
---|---|---|
@@ -1,34 +1,33 @@ | ||
# from diracx.client import Dirac | ||
# from diracx.client.models import JobSearchParams | ||
from diracx.client import Dirac | ||
from diracx.client.models import JobSearchParams | ||
|
||
# from diracx.cli.utils import get_auth_headers | ||
from diracx.cli.utils import get_auth_headers | ||
from diracx.core.preferences import DiracxPreferences | ||
|
||
# from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue | ||
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): | ||
self.endpoint = DiracxPreferences().url | ||
|
||
def fetch(self, parameters, jobIDs): | ||
with Dirac(endpoint=self.endpoint) 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 self.fetch(["MinorStatus"], jobIDs) | ||
|
||
# @convertToReturnValue | ||
# def getJobsMinorStatus(self, jobIDs): | ||
# return fetch(["MinorStatus"], jobIDs) | ||
@convertToReturnValue | ||
def getJobsStates(self, jobIDs): | ||
return self.fetch(["Status", "MinorStatus", "ApplicationStatus"], jobIDs) | ||
|
||
# @convertToReturnValue | ||
# def getJobsStates(self, jobIDs): | ||
# return fetch(["Status", "MinorStatus", "ApplicationStatus"], jobIDs) | ||
|
||
# @convertToReturnValue | ||
# def getJobsSites(self, jobIDs): | ||
# return fetch(["Site"], jobIDs) | ||
@convertToReturnValue | ||
def getJobsSites(self, jobIDs): | ||
return self.fetch(["Site"], jobIDs) |
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 was deleted.
Oops, something went wrong.
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,14 @@ | ||
#!/usr/bin/env bash | ||
# This script will export to the `Production.cfg` file to the | ||
# yaml format for diracx every 5 seconds | ||
|
||
source /home/dirac/ServerInstallDIR/bashrc | ||
git config --global user.name "DIRAC Server CI" | ||
git config --global user.email "dirac-server-ci@invalid" | ||
|
||
while true; | ||
do | ||
curl -L https://gitlab.cern.ch/chaen/chris-hackaton-cs/-/raw/master/convert-from-legacy.py |DIRAC_COMPAT_ENABLE_CS_CONVERSION=True ~/ServerInstallDIR/diracos/bin/python - ~/ServerInstallDIR/etc/Production.cfg /cs_store/initialRepo/ | ||
git -C /cs_store/initialRepo/ commit -am "export $(date)" | ||
sleep 5; | ||
done |