From 43225a155a985a7a56402df23dd550e48e22b436 Mon Sep 17 00:00:00 2001 From: Alexander Richards Date: Wed, 13 Jul 2022 16:48:14 +0100 Subject: [PATCH] Changing the RPCClient to be a wrapper as the DIRAC MagicMethod doesn't play nicely with RPyC. --- .../monitoring/diracrpc/DiracRPCServer.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/productionsystem/monitoring/diracrpc/DiracRPCServer.py b/productionsystem/monitoring/diracrpc/DiracRPCServer.py index a6264b5..feb3f38 100644 --- a/productionsystem/monitoring/diracrpc/DiracRPCServer.py +++ b/productionsystem/monitoring/diracrpc/DiracRPCServer.py @@ -74,14 +74,19 @@ 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): @@ -89,7 +94,7 @@ class DiracService(rpyc.Service): exposed_Job = FixedJob exposed_Dirac = FixedDirac - exposed_RPCClient = FixedRPCClient + exposed_RPCClient = RPCClientWrapper class DiracDaemon(Daemonize):