Skip to content

Commit

Permalink
fix: adding log headers to InputDataResolution modules
Browse files Browse the repository at this point in the history
  • Loading branch information
fstagni committed May 27, 2024
1 parent 42d349f commit 7b851fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
19 changes: 8 additions & 11 deletions src/DIRAC/WorkloadManagementSystem/Client/DownloadInputData.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ class DownloadInputData:
def __init__(self, argumentsDict):
"""Standard constructor"""
self.name = COMPONENT_NAME
self.log = gLogger.getSubLogger(self.name)
self.log.showHeaders(True)
self.inputData = argumentsDict["InputData"]
self.configuration = argumentsDict["Configuration"]
self.jobID = self.configuration.get("JobID")
# Warning: this contains not only the SEs but also the file metadata
self.fileCatalogResult = argumentsDict["FileCatalog"]
# By default put each input data file into a separate directory
self.inputDataDirectory = argumentsDict.get("InputDataDirectory", "PerFile")
self.jobID = None

self.log = gLogger.getSubLogger(f"[{self.jobID}]{self.__class__.__name__}")
self.log.showHeaders(True)

self.counter = 1
self.availableSEs = DMSHelpers().getStorageElements()

Expand All @@ -57,16 +59,9 @@ def execute(self, dataToResolve=None):
to leave room for any produced files.
"""

print("in execute")
gLogger.always("in execute, gLogger")
print(self.log)
self.log.always("in execute, self.log")

# Define local configuration options present at every site
localSESet = set(self.configuration["LocalSEList"])

self.jobID = self.configuration.get("JobID")

if dataToResolve:
self.log.verbose("Data to resolve passed directly to DownloadInputData module")
self.inputData = dataToResolve # e.g. list supplied by another module
Expand Down Expand Up @@ -179,10 +174,12 @@ def execute(self, dataToResolve=None):
self.log.error(error, lfn)
result = {"OK": False}
else:
self.log.info("Preliminary checks OK", f"download {lfn} from {seName}:")
self.log.info("Preliminary checks OK", f": now downloading {lfn} from {seName}")
result = self._downloadFromSE(lfn, seName, reps, guid)
if not result["OK"]:
self.log.error("Download failed", f"Tried downloading from SE {seName}: {result['Message']}")
else:
self.log.info(f"Download of {lfn} from {seName} finalized")
else:
result = {"OK": False}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ class InputDataByProtocol:
def __init__(self, argumentsDict):
"""Standard constructor"""
self.name = COMPONENT_NAME
self.log = gLogger.getSubLogger(self.name)
self.inputData = argumentsDict["InputData"]
self.configuration = argumentsDict["Configuration"]
self.jobID = self.configuration.get("JobID")
self.fileCatalogResult = argumentsDict["FileCatalog"]
self.jobID = None
self.log = gLogger.getSubLogger(f"[{self.jobID}]{self.__class__.__name__}")
self.log.showHeaders(True)
# This is because replicas contain SEs and metadata keys!
# FIXME: the structure of the dictionary must be fixed to avoid this mess
self.metaKeys = {
Expand Down Expand Up @@ -52,7 +53,6 @@ def execute(self, dataToResolve=None):

# Define local configuration options present at every site
localSEList = self.configuration["LocalSEList"]
self.jobID = self.configuration.get("JobID")
allReplicas = self.configuration.get("AllReplicas", False)
if allReplicas:
self.log.info("All replicas will be used in the resolution")
Expand Down

0 comments on commit 7b851fb

Please sign in to comment.