Skip to content

Commit

Permalink
start lgacy client and integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chaen committed Jul 5, 2023
1 parent f8a277b commit e8f6eda
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DIRAC/Core/Tornado/Client/ClientSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def ClientSelector(disetClient, *args, **kwargs): # We use same interface as RP
except Exception as e: # pylint: disable=broad-except
# If anything went wrong in the resolution, we return default RPCClient
# So the behaviour is exactly the same as before implementation of Tornado
# breakpoint()
sLog.warn("Could not select DISET or Tornado client", f"{repr(e)}")
rpc = disetClient(*args, **kwargs)
return rpc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
from DIRAC.Core.Utilities.DEncode import ignoreEncodeWarning
from DIRAC.Core.Utilities.JEncode import strToIntDict

from DIRAC.WorkloadManagementSystem.FutureClient.JobMonitoringClient import (
JobMonitoringClient as futureJobMonitoringClient,
)


@createClient("WorkloadManagement/JobMonitoring")
class JobMonitoringClient(Client):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.setServer("WorkloadManagement/JobMonitoring")

httpsClient = futureJobMonitoringClient

@ignoreEncodeWarning
def getJobsStatus(self, jobIDs):
res = self._getRPC().getJobsStatus(jobIDs)
Expand Down
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.
7 changes: 7 additions & 0 deletions tests/CI/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ services:
retries: 15
start_period: 60s

diracx:
image: gitlab-registry.cern.ch/chaen/chrissquare-hack-a-ton/diracx
container_name: diracx
environment:
- DIRAC_CS_SOURCE=todo
ports:
- 80:80

# Mock of an S3 storage
s3-direct:
Expand Down

0 comments on commit e8f6eda

Please sign in to comment.