Skip to content

Commit

Permalink
feat: Download files with a shifter proxy (handler modiff)
Browse files Browse the repository at this point in the history
  • Loading branch information
martynia committed Aug 15, 2023
1 parent 98a1272 commit 12e3595
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ def getRemotePilotLogs(self, pilotStamp, vo=None):

sLog.info(f"Proxy used for retrieving pilot logs: VO: {vo}, User: {proxyUser}, Group: {proxyGroup}")

res = self._downloadLogs(
res = self._downloadLogs( # pylint: disable=unexpected-keyword-arg
lfn, filepath, proxyUserName=proxyUser, proxyUserGroup=proxyGroup
) # pylint: disable=unexpected-keyword-arg
)
sLog.debug("getFile result:", res)
if not res["OK"]:
sLog.error(f"Failed to contact storage")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from DIRAC import S_OK, S_ERROR
import DIRAC.Core.Utilities.TimeUtilities as TimeUtilities
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
from DIRAC.ConfigurationSystem.Client.Helpers.Registry import getUsernameForDN, getDNForUsername, getVOForGroup
from DIRAC.Core.DISET.RequestHandler import getServiceOption
from DIRAC.Core.DISET.RequestHandler import RequestHandler
Expand All @@ -33,6 +34,9 @@ def initializeHandler(cls, serviceInfoDict):

except RuntimeError as excp:
return S_ERROR(f"Can't connect to DB: {excp}")
# classic or remote first ?
opsHelper = Operations(vo=vo, setup=self.setup)
uploadPath = opsHelper.getValue("Pilot/UploadPath", "")
# prepare remote pilot plugin initialization
defaultOption, defaultClass = "DownloadPlugin", "FileCacheDownloadPlugin"
cls.configValue = getServiceOption(serviceInfoDict, defaultOption, defaultClass)
Expand Down Expand Up @@ -181,6 +185,7 @@ def export_getRemotePilotOutput(self, pilotReference):
pilotStamp = pilotDict["PilotStamp"]
owner = pilotDict["OwnerDN"]
group = pilotDict["OwnerGroup"]
vo = getVOForGroup(group)

if self.loggingPlugin is None:
result = ObjectLoader().loadObject(
Expand All @@ -194,15 +199,7 @@ def export_getRemotePilotOutput(self, pilotReference):
self.loggingPlugin = componentClass()
self.log.info("Loaded: PilotLoggingPlugin class", self.configValue)

remoteCredentials = self.getRemoteCredentials()
proxyUser = remoteCredentials["user"]
proxyGroup = remoteCredentials["group"]
vo = getVOForGroup(proxyGroup)
self.log.info(f"Proxy used for retrieving pilot logs: VO: {vo}, User: {proxyUser}, Group: {proxyGroup}")

res = self.loggingPlugin.getRemotePilotLogs(
pilotStamp, vo, proxyUserName=proxyUser, proxyUserGroup=proxyGroup
) # pylint: disable=unexpected-keyword-arg
res = self.loggingPlugin.getRemotePilotLogs(pilotStamp, vo)

if res["OK"]:
res["Value"]["OwnerDN"] = owner
Expand Down

0 comments on commit 12e3595

Please sign in to comment.