Beispiel #1
0
    def copy(self):
        """
        1) local copy: it is the default. The output will be copied under crab_working_dir/res dir
        2) copy to a remote SE specifying -dest_se (official CMS remote SE)
           or -dest_endpoint (not official, needed the complete endpoint)
        """

        to_copy = {}
        results = {}
        tmp = ''

        lfn, to_copy = self.checkAvailableList()

        if (self.copy_local == 1):
            outputDir = self.cfg_params.get('USER.outputdir',
                                            common.work_space.resDir())
            common.logger.info("Copy file locally.\n\tOutput dir: %s" %
                               outputDir)
            dest = {"destinationDir": outputDir}
        else:
            if (self.dest_se != 'local'):
                from PhEDExDatasvcInfo import PhEDExDatasvcInfo
                phedexCfg = {'storage_element': self.dest_se}
                stageout = PhEDExDatasvcInfo(config=phedexCfg)
                self.endpoint = stageout.getStageoutPFN()

                if (str(lfn).find("/store/temp/") == 0):
                    tmp = lfn.replace("/store/temp/", "/", 1)
                elif (str(lfn).find("/store/") == 0):
                    tmp = lfn.replace("/store/", "/", 1)
                else:
                    tmp = lfn

                common.logger.debug("Source LFN = %s" % lfn)
                common.logger.debug("tmp LFN = %s" % tmp)
                self.endpoint = self.endpoint + tmp
            else:
                self.endpoint = self.dest_endpoint

            common.logger.info("Copy file to remote SE.\n\tEndpoint: %s" %
                               self.endpoint)

            dest = {"destination": self.endpoint}

        for key in to_copy.keys():
            cmscpConfig = {
                "source": key,
                "inputFileList": to_copy[key],
                "protocol": self.protocol,
                #"debug":'1'
            }
            cmscpConfig.update(dest)

            common.logger.debug("Source = %s" % key)
            common.logger.debug("Files = %s" % to_copy[key])
            common.logger.debug("CmscpConfig = %s" % str(cmscpConfig))

            results.update(self.performCopy(cmscpConfig))
        return results
Beispiel #2
0
    def copy(self):
        """
        1) local copy: it is the default. The output will be copied under crab_working_dir/res dir
        2) copy to a remote SE specifying -dest_se (official CMS remote SE)
           or -dest_endpoint (not official, needed the complete endpoint)
        """

        to_copy = {}
        results = {}
        tmp = ""

        lfn, to_copy = self.checkAvailableList()

        if self.copy_local == 1:
            outputDir = self.cfg_params.get("USER.outputdir", common.work_space.resDir())
            common.logger.info("Copy file locally.\n\tOutput dir: %s" % outputDir)
            dest = {"destinationDir": outputDir}
        else:
            if self.dest_se != "local":
                from PhEDExDatasvcInfo import PhEDExDatasvcInfo

                phedexCfg = {"storage_element": self.dest_se}
                stageout = PhEDExDatasvcInfo(config=phedexCfg)
                self.endpoint = stageout.getStageoutPFN()

                if str(lfn).find("/store/temp/") == 0:
                    tmp = lfn.replace("/store/temp/", "/", 1)
                elif str(lfn).find("/store/") == 0:
                    tmp = lfn.replace("/store/", "/", 1)
                else:
                    tmp = lfn

                common.logger.debug("Source LFN = %s" % lfn)
                common.logger.debug("tmp LFN = %s" % tmp)
                self.endpoint = self.endpoint + tmp
            else:
                self.endpoint = self.dest_endpoint

            common.logger.info("Copy file to remote SE.\n\tEndpoint: %s" % self.endpoint)

            dest = {"destination": self.endpoint}

        for key in to_copy.keys():
            cmscpConfig = {
                "source": key,
                "inputFileList": to_copy[key],
                "protocol": self.protocol,
                # "debug":'1'
            }
            cmscpConfig.update(dest)

            common.logger.debug("Source = %s" % key)
            common.logger.debug("Files = %s" % to_copy[key])
            common.logger.debug("CmscpConfig = %s" % str(cmscpConfig))

            results.update(self.performCopy(cmscpConfig))
        return results