Skip to content

Commit

Permalink
Changing the RPCClient to be a wrapper as the DIRAC MagicMethod doesn…
Browse files Browse the repository at this point in the history
…'t play nicely with RPyC.
  • Loading branch information
alexanderrichards committed Jul 13, 2022
1 parent 23797de commit 43225a1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions productionsystem/monitoring/diracrpc/DiracRPCServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,27 @@ def rescheduleJob(self, jobid):
return super(FixedDirac, self).rescheduleJob(jobid)


class FixedRPCClient(RPCClient):
# Switched from inheritance to composition as the DIRAC _MagicMethods were
# not playing nicely with RPyC. using composition as a wrapper is better as
# keeps all the DIRAC stuff server side.
class RPCClientWrapper(object):
"""Fixed DIRAC RPC Client."""

def exposed_listDirectory(self, *args):
def __init__(self, *args, **kwargs):
"""Initialise."""
self._wrapped = RPCClient(*args, **kwargs)

def listDirectory(self, *args):
"""Expose list directory."""
return self.listDirectory(*args)
# return RPCClient("DataManagement/FileCatalog").listDirectory('/', False)
# return self.listDirectory(self, *args, **kwargs)
return self._wrapped.listDirectory(*args)


class DiracService(rpyc.Service):
"""DIRAC RPyC Service."""

exposed_Job = FixedJob
exposed_Dirac = FixedDirac
exposed_RPCClient = FixedRPCClient
exposed_RPCClient = RPCClientWrapper


class DiracDaemon(Daemonize):
Expand Down

0 comments on commit 43225a1

Please sign in to comment.