From 5117f7c52022714b592cd0787ee8465b6dd9637e Mon Sep 17 00:00:00 2001 From: qunox Date: Fri, 11 Apr 2014 15:37:46 +0200 Subject: [PATCH] enable xrootd url output --- src/python/CRABClient/Commands/SubCommand.py | 2 +- src/python/CRABClient/Commands/getcommand.py | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/python/CRABClient/Commands/SubCommand.py b/src/python/CRABClient/Commands/SubCommand.py index 569669984..0b5208830 100644 --- a/src/python/CRABClient/Commands/SubCommand.py +++ b/src/python/CRABClient/Commands/SubCommand.py @@ -285,7 +285,7 @@ def __call__(self): def terminate(self, exitcode): #We do not want to print logfile for each command... if exitcode < 2000: - if getattr(self.options, 'dump', False): + if getattr(self.options, 'dump', False) or getattr(self.options, 'xroot', False): self.logger.debug("Log file is %s" % os.path.abspath(self.logfile)) else: self.logger.info("Log file is %s" % os.path.abspath(self.logfile)) diff --git a/src/python/CRABClient/Commands/getcommand.py b/src/python/CRABClient/Commands/getcommand.py index 27432cfba..346083b66 100644 --- a/src/python/CRABClient/Commands/getcommand.py +++ b/src/python/CRABClient/Commands/getcommand.py @@ -1,3 +1,4 @@ + from CRABClient.Commands import CommandResult, mergeResults from CRABClient.Commands.remote_copy import remote_copy from CRABClient.Commands.SubCommand import SubCommand @@ -34,8 +35,8 @@ def __call__(self, **argv): elif not os.path.isdir( self.dest ): raise ConfigurationException('Destination directory is a file') - if self.options.dump: - self.logger.debug("Setting the destination to %s " % self.dest ) + if self.options.dump or self.options.xroot: + self.logger.debug("Getting url info") else: self.logger.info("Setting the destination to %s " % self.dest ) @@ -67,7 +68,11 @@ def __call__(self, **argv): workflow = dictresult['result'] #TODO assigning workflow to dictresult. for the moment we have only one wf arglist = ['-d', self.dest, '-i', workflow, '-t', self.options.task, '-p', self.proxyfilename, '-l',self.options.nparallel, '-w',self.options.waittime] if len(workflow) > 0: - if self.dump: + if self.options.xroot: + self.logger.debug("XRootD url is requested") + for fileinfo in workflow: + self.logger.info("root://cms-xrd-global.cern.ch/%s" % fileinfo['lfn']) + elif self.dump: for fileInfo in workflow: self.logger.info(fileInfo['pfn']) else: @@ -102,6 +107,12 @@ def setOptions(self): action = 'store_true', help = 'Instead of performing the transfer, dump the source URLs.' ) + self.parser.add_option( '-x', '--xrootd', + dest = 'xroot', + default = False, + action = 'store_true', + help = 'Give XrootD url for the file' ) + self.parser.add_option( '-i', '--jobids', dest = 'jobids', default = None, @@ -131,3 +142,4 @@ def validateOptions(self): self.dump = self.options.dump +