From 04836b9324db3633703263303731133a11df6242 Mon Sep 17 00:00:00 2001 From: Stefano Belforte Date: Fri, 26 Jul 2024 12:54:43 +0200 Subject: [PATCH] Small fixes for rucio publisher (#8566) * fix use of migrationLogDir in TaskPublishRucio * fix use of markFailed in TaskPublishRucio * pylint: lazy logging in PublisherMasterRucio * fix typo in argument name --- src/python/Publisher/PublisherMasterRucio.py | 10 ++++------ src/python/Publisher/TaskPublish.py | 3 ++- src/python/Publisher/TaskPublishRucio.py | 6 ++++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/python/Publisher/PublisherMasterRucio.py b/src/python/Publisher/PublisherMasterRucio.py index 7e508df5fb..844addade2 100644 --- a/src/python/Publisher/PublisherMasterRucio.py +++ b/src/python/Publisher/PublisherMasterRucio.py @@ -1,4 +1,4 @@ -# pylint: disable=invalid-name # have a lot of snake_case varaibles here from "old times" +# pylint: disable=invalid-name # have a lot of snake_case variables here from "old times" """ Here's the algorithm @@ -314,7 +314,7 @@ def startSlave(self, task): # pylint: disable=too-many-branches, too-many-local lfnsToPublish.append(fileDict['destination_lfn']) FilesInfoFromTBDInBlock[blockName] = filesInfo - logger.info(f"Prepare publish info for {len(blocksToPublish)} blocks") + logger.info("Prepare publish info for %s blocks", len(blocksToPublish)) # so far so good @@ -378,8 +378,7 @@ def startSlave(self, task): # pylint: disable=too-many-branches, too-many-local if toFail: logger.info('Did not find useful metadata for %d files. Mark as failed', len(toFail)) - nMarked = self.markAsFailed(lfns=toFail, reason='FileMetadata not found') - logger.info('marked %d files as Failed', nMarked) + self.markAsFailed(lfns=toFail, reason='FileMetadata not found') # call taskPublishRucio self.runTaskPublish(workflow, logger) @@ -393,9 +392,8 @@ def markAsFailed(self, lfns=None, reason=None): """ handy wrapper for PublisherUtils/markFailed """ - nMarked = markFailed(files=lfns, crabserver=self.crabserver, failureReason=reason, + markFailed(files=lfns, crabServer=self.crabserver, failureReason=reason, asoworker=self.config.asoworker, logger=self.logger) - return nMarked def pollInterval(self): """ diff --git a/src/python/Publisher/TaskPublish.py b/src/python/Publisher/TaskPublish.py index ce8dae553a..f6f07b32a2 100644 --- a/src/python/Publisher/TaskPublish.py +++ b/src/python/Publisher/TaskPublish.py @@ -29,7 +29,8 @@ def publishInDBS3(config, taskname, verbose, console): """ # a few dictionaries to pass global information around all these functions # initialized here to None simply as documentation - log = {'logger': None, 'logdir': None, 'logTaskDir': None, 'taskFilesDir': None} + log = {'logger': None, 'logdir': None, 'logTaskDir': None, + 'taskFilesDir': None, 'migrationLogDir': None} DBSApis = {'source': None, 'destRead': None, 'destWrite': None, 'global': None, 'migrate': None} nothingToDo = {} # a pre-filled SummaryFile in case of no useful input or errors diff --git a/src/python/Publisher/TaskPublishRucio.py b/src/python/Publisher/TaskPublishRucio.py index 057fb5cd17..d2a4fc47e4 100644 --- a/src/python/Publisher/TaskPublishRucio.py +++ b/src/python/Publisher/TaskPublishRucio.py @@ -30,7 +30,8 @@ def publishInDBS3(config, taskname, verbose, console): # pylint: disable=too-ma """ # a few dictionaries to pass global information around all these functions # initialized here to None simply as documentation - log = {'logger': None, 'logdir': None, 'logTaskDir': None, 'taskFilesDir': None} + log = {'logger': None, 'logdir': None, 'logTaskDir': None, + 'taskFilesDir': None, 'migrationLogDir': None} DBSApis = {'source': None, 'destRead': None, 'destWrite': None, 'global': None, 'migrate': None} nothingToDo = {} # a pre-filled SummaryFile in case of no useful input or errors @@ -115,7 +116,8 @@ def publishOneBlockInDBS(blockDict=None, DBSConfigs=None, logger=None): statusCode, failureMsg = migrateByBlockDBS3( taskname, DBSApis['migrate'], DBSApis['destRead'], DBSApis['global'], - globalParentBlocks, logger=logger, verbose=verbose) + globalParentBlocks, + log['migrationLogDir'], logger=logger, verbose=verbose) except Exception as ex: logger.exception('Exception raised inside migrateByBlockDBS3\n%s', ex) statusCode = 1