Skip to content

Commit 14ca988

Browse files
authored
Merge pull request #8135 from fstagni/90_pool_xml_slice_directory
[9.0] the PoolXMLSlice should be created in the same directory where the job runs
2 parents 8fddded + 4587863 commit 14ca988

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

src/DIRAC/WorkloadManagementSystem/Client/InputDataResolution.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
result and in principle has all the necessary information to resolve input data
77
for applications.
88
"""
9+
from pathlib import Path
10+
911
import DIRAC
1012
from DIRAC import S_ERROR, S_OK, gConfig, gLogger
1113
from DIRAC.ConfigurationSystem.Client.Helpers.Operations import Operations
@@ -76,7 +78,7 @@ def _createCatalog(self, resolvedInputData, catalogName="pool_xml_catalog.xml",
7678
self.log.verbose(f"Catalog name will be: {catalogName}")
7779

7880
resolvedData = tmpDict
79-
appCatalog = PoolXMLSlice(catalogName)
81+
appCatalog = PoolXMLSlice(catalogName, Path(self.arguments["Configuration"].get("JobIDPath", "")))
8082
return appCatalog.execute(resolvedData)
8183

8284
def __resolveInputData(self):

src/DIRAC/WorkloadManagementSystem/Client/PoolXMLSlice.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010

1111

1212
class PoolXMLSlice:
13-
def __init__(self, catalogName):
13+
def __init__(self, catalogName, jobID_path: os.PathLike):
1414
"""Standard constructor"""
1515
self.fileName = catalogName
16+
self.jobID_path = jobID_path
1617
self.log = gLogger.getSubLogger(self.__class__.__name__)
1718

1819
def execute(self, dataDict):
1920
"""Given a dictionary of resolved input data, this will creates a POOL XML slice."""
20-
poolXMLCatName = self.fileName
2121
try:
2222
poolXMLCat = PoolXMLCatalog()
2323
self.log.verbose("Creating POOL XML slice")
@@ -41,18 +41,19 @@ def execute(self, dataDict):
4141
xmlSlice = poolXMLCat.toXML()
4242
self.log.verbose("POOL XML Slice is: ")
4343
self.log.verbose(xmlSlice)
44-
with open(poolXMLCatName, "w") as poolSlice:
44+
with open(self.jobID_path / self.fileName, "w") as poolSlice:
4545
poolSlice.write(xmlSlice)
46-
self.log.info(f"POOL XML Catalogue slice written to {poolXMLCatName}")
46+
self.log.info(f"POOL XML Catalogue slice written to {self.jobID_path / self.fileName}")
4747
try:
4848
# Temporary solution to the problem of storing the SE in the Pool XML slice
49-
with open(f"{poolXMLCatName}.temp", "w") as poolSlice_temp:
49+
with open(self.jobID_path / (self.fileName + ".temp"), "w") as poolSlice_temp:
5050
xmlSlice = poolXMLCat.toXML(True)
5151
poolSlice_temp.write(xmlSlice)
52-
except Exception as x:
53-
self.log.warn(f"Attempted to write catalog also to {poolXMLCatName}.temp but this failed")
54-
except Exception as x:
55-
self.log.error(str(x))
52+
except Exception:
53+
self.log.warn(f"Attempted to write catalog also to {self.fileName}.temp but this failed")
54+
self.log.exception()
55+
except Exception:
56+
self.log.exception()
5657
return S_ERROR("Exception during construction of POOL XML slice")
5758

5859
return S_OK("POOL XML Slice created")

src/DIRAC/WorkloadManagementSystem/JobWrapper/JobWrapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@ def resolveInputData(self):
765765

766766
configDict = {
767767
"JobID": self.jobID,
768+
"JobIDPath": self.jobIDPath,
768769
"LocalSEList": localSEList,
769770
"DiskSEList": self.diskSE,
770771
"TapeSEList": self.tapeSE,

0 commit comments

Comments
 (0)