def createDir(self, Destination_SE, protocol): """ Create remote dir for gsiftp REALLY TEMPORARY this should be transparent at SE API level. """ if self.debug : print 'createDir():' msg = '' try: action = SBinterface( Destination_SE ) action.createDir() if self.debug: print "\tThe directory has been created using protocol %s"%protocol except TransferException, ex: msg = "ERROR: problem with the directory creation using %s protocol "%protocol msg += str(ex) if self.debug : dbgmsg = '\t'+msg+'\n\t'+str(ex.detail)+'' dbgmsg += '\t'+str(ex.output)+'' print dbgmsg raise Exception(msg)
def createDir(self, Destination_SE, protocol): """ Create remote dir for gsiftp REALLY TEMPORARY this should be transparent at SE API level. """ if self.debug : print 'createDir():\n' msg = '' try: action = SBinterface( Destination_SE ) action.createDir() if self.debug: print "\tThe directory has been created using protocol %s"%protocol except TransferException, ex: msg = "ERROR: problem with the directory creation using %s protocol "%protocol msg += str(ex) if self.debug : dbgmsg = '\t'+msg+'\n\t'+str(ex.detail)+'\n' dbgmsg += '\t'+str(ex.output)+'\n' print dbgmsg raise Exception(msg)
return results ## when the client commands are not found (wrong env or really missing) except MissingCommand, ex: msg = "ERROR %s %s" %(str(ex), str(ex.detail)) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '10041', msg)) return results except Exception, ex: msg = "ERROR %s" %(str(ex)) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '-1', msg)) return results ## prepare for real copy ## try : sbi = SBinterface( Source_SE, Destination_SE ) sbi_dest = SBinterface(Destination_SE) sbi_source = SBinterface(Source_SE) except ProtocolMismatch, ex: msg = "ERROR : Unable to create SBinterface with %s protocol"%protocol msg += str(ex) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '-1', msg)) return results ## loop over the complete list of files for filetocopy in list_file: if self.debug : print '\tStart real copy for %s'%filetocopy try : ErCode, msg = self.checkFileExist( sbi_source, sbi_dest, filetocopy, options ) except Exception, ex:
results.update( self.updateReport(filetocopy, '60316', str(ex))) return results ## when the client commands are not found (wrong env or really missing) except MissingCommand, ex: msg = "ERROR %s %s" %(str(ex), str(ex.detail)) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '10041', msg)) return results except Exception, ex: msg = "ERROR %s" %(str(ex)) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '-1', msg)) return results ## prepare for real copy ## try : sbi = SBinterface( Source_SE, Destination_SE ) sbi_dest = SBinterface(Destination_SE) sbi_source = SBinterface(Source_SE) except ProtocolMismatch, ex: msg = "ERROR : Unable to create SBinterface with %s protocol"%protocol msg += str(ex) for filetocopy in list_file: results.update( self.updateReport(filetocopy, '-1', msg)) return results ## loop over the complete list of files for filetocopy in list_file: if self.debug : print '\tStart real copy for %s'%filetocopy try : ErCode, msg = self.checkFileExist( sbi_source, sbi_dest, filetocopy, options )
if (common.scheduler.name().upper() == 'CAF' and str.split(str(endpoint), ':')[0] == 'root'): protocol = 'xrootd' else : protocol = self.protocolDict[common.scheduler.name().upper()] msg = 'protocol = ' + protocol + '\n' msg += 'endpoint = ' + endpoint + '\n' common.logger.debug(msg) try: Storage = SElement( FullPath(string.strip(endpoint)), protocol ) except Exception, ex: common.logger.debug(traceback.format_exc()) raise Exception(str(ex)) try: action = SBinterface(Storage, logger = common.logger.logger) except Exception, ex: common.logger.debug(traceback.format_exc()) raise Exception(str(ex)) try: options=self.protocolOpt[protocol] if protocol == 'srm-lcg': options="-d " + options check = action.checkExists(opt=options) if check is True : common.logger.info("WARNING: The stageout directory already exists. Be careful not to accidentally mix outputs from different tasks") remoteList=[] except Exception, e: common.logger.debug(traceback.format_exc()) raise CrabException("Failure while checking remote dir: "+str(e))
and str.split(str(endpoint), ':')[0] == 'root'): protocol = 'xrootd' else: protocol = self.protocolDict[common.scheduler.name().upper()] msg = 'protocol = ' + protocol + '\n' msg += 'endpoint = ' + endpoint + '\n' common.logger.debug(msg) try: Storage = SElement(FullPath(string.strip(endpoint)), protocol) except Exception, ex: common.logger.debug(traceback.format_exc()) raise Exception(str(ex)) try: action = SBinterface(Storage, logger=common.logger.logger) except Exception, ex: common.logger.debug(traceback.format_exc()) raise Exception(str(ex)) try: options = self.protocolOpt[protocol] if protocol == 'srm-lcg': options = "-d " + options check = action.checkExists(opt=options) if check is True: common.logger.info( "WARNING: The stageout directory already exists. Be careful not to accidentally mix outputs from different tasks" ) remoteList = [] except Exception, e: