Skip to content

Commit

Permalink
Small fixes for rucio publisher (dmwm#8566)
Browse files Browse the repository at this point in the history
* fix use of migrationLogDir in TaskPublishRucio

* fix use of markFailed in TaskPublishRucio

* pylint: lazy logging in PublisherMasterRucio

* fix typo in argument name
  • Loading branch information
belforte authored Jul 26, 2024
1 parent 9f906f7 commit 04836b9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/python/Publisher/PublisherMasterRucio.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)
Expand All @@ -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):
"""
Expand Down
3 changes: 2 additions & 1 deletion src/python/Publisher/TaskPublish.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions src/python/Publisher/TaskPublishRucio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 04836b9

Please sign in to comment.