Skip to content

Commit

Permalink
Merge pull request DIRACGrid#7201 from aldbr/v8.1_FIX_diracx-client-use
Browse files Browse the repository at this point in the history
[8.1] fix: align JobMonitoringClient with the new DiracClient
  • Loading branch information
chrisburr authored Sep 14, 2023
2 parents 208bb79 + cce8c21 commit e7afdc6
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
# pylint: disable=import-error
from diracx.client import Dirac
from diracx.client import DiracClient
from diracx.client.models import JobSearchParams

from diracx.cli.utils import get_auth_headers
from diracx.core.preferences import DiracxPreferences

from DIRAC.Core.Utilities.ReturnValues import convertToReturnValue


class JobMonitoringClient:
def __init__(self, *args, **kwargs):
self.endpoint = DiracxPreferences().url

def fetch(self, parameters, jobIDs):
with Dirac(endpoint=self.endpoint) as api:
with DiracClient() 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}

Expand Down

0 comments on commit e7afdc6

Please sign in to comment.