Skip to content

Commit 0410187

Browse files
committed
feat: Include DiracX token in proxy writen by JobAgent
1 parent 866204c commit 0410187

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/DIRAC/WorkloadManagementSystem/Agent/JobAgent.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import re
1010
import time
11+
from pathlib import Path
1112

1213
from diraccfg import CFG
1314

@@ -17,6 +18,7 @@
1718
from DIRAC.Core.Base.AgentModule import AgentModule
1819
from DIRAC.Core.Security.ProxyInfo import getProxyInfo
1920
from DIRAC.Core.Security import Properties
21+
from DIRAC.Core.Security.ProxyFile import writeChainToTemporaryFile
2022
from DIRAC.Core.Utilities import DErrno
2123
from DIRAC.Core.Utilities.ObjectLoader import ObjectLoader
2224
from DIRAC.FrameworkSystem.Client.ProxyManagerClient import gProxyManager
@@ -626,13 +628,15 @@ def _submitJob(
626628

627629
self.log.info("Submitting JobWrapper", f"{os.path.basename(wrapperFile)} to {self.ceName}CE")
628630

629-
# Pass proxy to the CE
630-
proxy = proxyChain.dumpAllToString()
631-
if not proxy["OK"]:
632-
self.log.error("Invalid proxy", proxy)
633-
return S_ERROR("Payload Proxy Not Found")
631+
# Pass proxy to the CE, writing it to a temporary file to ensure the DiracX token is included
632+
retVal = writeChainToTemporaryFile(proxyChain)
633+
if not retVal["OK"]:
634+
self.log.error("Invalid proxy", retVal["Message"])
635+
return S_ERROR("Failed to write proxy to temporary file")
636+
proxyLocation = Path(retVal["Value"])
637+
payloadProxy = proxyLocation.read_text()
638+
proxyLocation.unlink()
634639

635-
payloadProxy = proxy["Value"]
636640
try:
637641
result = self.computingElement.submitJob(
638642
wrapperFile,

0 commit comments

Comments
 (0)