10
10
11
11
12
12
class PoolXMLSlice :
13
- def __init__ (self , catalogName ):
13
+ def __init__ (self , catalogName , jobID_path : os . PathLike ):
14
14
"""Standard constructor"""
15
15
self .fileName = catalogName
16
+ self .jobID_path = jobID_path
16
17
self .log = gLogger .getSubLogger (self .__class__ .__name__ )
17
18
18
19
def execute (self , dataDict ):
19
20
"""Given a dictionary of resolved input data, this will creates a POOL XML slice."""
20
- poolXMLCatName = self .fileName
21
21
try :
22
22
poolXMLCat = PoolXMLCatalog ()
23
23
self .log .verbose ("Creating POOL XML slice" )
@@ -41,18 +41,19 @@ def execute(self, dataDict):
41
41
xmlSlice = poolXMLCat .toXML ()
42
42
self .log .verbose ("POOL XML Slice is: " )
43
43
self .log .verbose (xmlSlice )
44
- with open (poolXMLCatName , "w" ) as poolSlice :
44
+ with open (self . jobID_path / self . fileName , "w" ) as poolSlice :
45
45
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 } " )
47
47
try :
48
48
# 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 :
50
50
xmlSlice = poolXMLCat .toXML (True )
51
51
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 ()
56
57
return S_ERROR ("Exception during construction of POOL XML slice" )
57
58
58
59
return S_OK ("POOL XML Slice created" )
0 commit comments