From 97d720242a56416f07edc4d98a6f91a8507521a8 Mon Sep 17 00:00:00 2001 From: Alexey Anisenkov Date: Tue, 10 Sep 2024 22:38:05 +0700 Subject: [PATCH] report back file.ddmendpoint value for alternative staged files --- pilot/control/data.py | 22 +++++++++++++++------- pilot/info/filespec.py | 1 + 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pilot/control/data.py b/pilot/control/data.py index 4c36d70a..506ce68a 100644 --- a/pilot/control/data.py +++ b/pilot/control/data.py @@ -924,14 +924,16 @@ def _do_stageout(job: JobData, args: object, xdata: list, activity: list, title: # check if alt stageout can be applied (all remain files must have alt storage declared ddmendpoint_alt) has_altstorage = all(entry.ddmendpoint_alt and entry.ddmendpoint != entry.ddmendpoint_alt for entry in remain_files) - logger.info('alt stage-out settings[%s]: is_unified=%s, altstageout=%s, remain_files=%s, has_altstorage=%s', + logger.info('alt stage-out settings: %s, is_unified=%s, altstageout=%s, remain_files=%s, has_altstorage=%s', activity, is_unified, altstageout, len(remain_files), has_altstorage) if altstageout and remain_files and has_altstorage: # apply alternative stageout for failed transfers for entry in remain_files: entry.ddmendpoint = entry.ddmendpoint_alt entry.ddmendpoint_alt = None + entry.is_altstaged = True + logger.info('alt stage-out will be applied for remain=%s files (previously failed)', len(remain_files)) client.transfer(xdata, activity, **kwargs) except PilotException as error: @@ -1072,12 +1074,18 @@ def generate_fileinfo(job: JobData) -> dict: """ fileinfo = {} checksum_type = config.File.checksum_type if config.File.checksum_type == 'adler32' else 'md5sum' - for iofile in job.outdata + job.logdata: - if iofile.status in {'transferred'}: - fileinfo[iofile.lfn] = {'guid': iofile.guid, - 'fsize': iofile.filesize, - f'{checksum_type}': iofile.checksum.get(config.File.checksum_type), - 'surl': iofile.turl} + for entry in job.outdata + job.logdata: + if entry.status in {'transferred'}: + dat = { + 'guid': entry.guid, + 'fsize': entry.filesize, + f'{checksum_type}': entry.checksum.get(config.File.checksum_type), + 'surl': entry.turl + } + if entry.is_altstaged: + dat['ddmendpoint'] = entry.ddmendpoint + + fileinfo[entry.lfn] = dat return fileinfo diff --git a/pilot/info/filespec.py b/pilot/info/filespec.py index 307b18c9..ef4700ed 100644 --- a/pilot/info/filespec.py +++ b/pilot/info/filespec.py @@ -77,6 +77,7 @@ class FileSpec(BaseData): is_tar = False # whether it's a tar file or not ddm_activity = None # DDM activity names (e.g. [read_lan, read_wan]) which should be used to resolve appropriate protocols from StorageData.arprotocols checkinputsize = True + is_altstaged = None # indicates if file was transferred using alternative method (altstageout) # specify the type of attributes for proper data validation and casting _keys = {int: ['filesize', 'mtime', 'status_code'],