Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] added log headers to InputDataResolution modules #7639

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions src/DIRAC/WorkloadManagementSystem/Client/DownloadInputData.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
########################################################################
# File : DownloadInputData.py
# Author : Stuart Paterson
########################################################################

""" The Download Input Data module wraps around the Replica Management
components to provide access to datasets by available site protocols as
defined in the CS for the VO.
components to provide access to datasets by downloading locally
"""
import os
import tempfile
import random
import tempfile

from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC.WorkloadManagementSystem.Client.JobStateUpdateClient import JobStateUpdateClient
from DIRAC.Resources.Storage.StorageElement import StorageElement
from DIRAC import S_ERROR, S_OK, gLogger
from DIRAC.Core.Utilities.Os import getDiskSpace
from DIRAC.Core.Utilities.ReturnValues import returnSingleResult
from DIRAC.DataManagementSystem.Utilities.DMSHelpers import DMSHelpers
from DIRAC.Resources.Storage.StorageElement import StorageElement
from DIRAC.WorkloadManagementSystem.Client.JobStateUpdateClient import JobStateUpdateClient

COMPONENT_NAME = "DownloadInputData"

Expand All @@ -37,15 +31,17 @@ class DownloadInputData:
#############################################################################
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")
# 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 @@ -59,8 +55,6 @@ def execute(self, dataToResolve=None):
# 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 @@ -173,10 +167,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
14 changes: 4 additions & 10 deletions src/DIRAC/WorkloadManagementSystem/Client/InputDataByProtocol.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
########################################################################
# File : InputDataByProtocol.py
# Author : Stuart Paterson
########################################################################

""" The Input Data By Protocol module wraps around the Replica Management
components to provide access to datasets by available site protocols as
defined in the CS for the VO.
"""
from DIRAC import S_OK, S_ERROR, gLogger
from DIRAC import S_ERROR, S_OK, gLogger
from DIRAC.Resources.Storage.StorageElement import StorageElement
from DIRAC.WorkloadManagementSystem.Client.JobStateUpdateClient import JobStateUpdateClient

Expand All @@ -18,12 +13,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 +47,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
Loading