当前位置: 首页>>代码示例>>Python>>正文


Python SubCommand.SubCommand类代码示例

本文整理汇总了Python中CRABClient.Commands.SubCommand.SubCommand的典型用法代码示例。如果您正苦于以下问题:Python SubCommand类的具体用法?Python SubCommand怎么用?Python SubCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SubCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        if self.options.sitename is None:
            msg  = "%sError%s: Please specify the site where to check the write permissions." % (colors.RED, colors.NORMAL)
            msg += " Use the --site option."
            ex = MissingOptionException(msg)
            ex.missingOption = "sitename"
            raise ex
        if hasattr(self.options, 'command') and self.options.command != None:
            AvailableCommands = ['LCG', 'GFAL']
            self.command = self.options.command.upper()
            if self.command not in AvailableCommands:
                msg = "You specified to use %s command and it is not allowed. Available commands are: %s " % (self.command, str(AvailableCommands))
                ex = ConfigurationException(msg)
                raise ex
        else:
            self.command = None
        if hasattr(self.options, 'checksum'):
            if re.match('^yes$|^no$', self.options.checksum):
                self.checksum = 'ADLER32' if self.options.checksum == 'yes' else None
            else:
                msg = "You specified to use %s checksum. Only lowercase yes/no is accepted to turn ADLER32 checksum" % self.options.checksum
                ex = ConfigurationException(msg)
                raise ex
开发者ID:AndresTanasijczuk,项目名称:CRABClient,代码行数:25,代码来源:checkwrite.py

示例2: validateOptions

    def validateOptions(self):
        """
        Check if the sitelist parameter is a comma separater list of cms sitenames,
        and put the strings to be passed to the server to self
        """
        SubCommand.validateOptions(self)

        #Checking if the sites provided by the user are valid cmsnames. Doing this because with only the
        #server error handling we get:
        #    Server answered with: Invalid input parameter
        #    Reason is: Incorrect 'siteblacklist' parameter
        #which is not really user friendly.
        #Moreover, I prefer to be independent from Lexicon. I'll the regex here.
        sn_re = "^T[1-3]_[A-Z]{2}(_[A-Za-z0-9]+)+$" #sn_re => SiteName_RegularExpression
        sn_rec = re.compile(sn_re) #sn_rec => SiteName_RegularExpressionCompiled

        self.sitewhitelist = ''
        self.siteblsklist = ''

        for siteList in ['sitewhitelist', 'siteblacklist']:
            result = ''
            paramVal = getattr(self.options, siteList, None)
            if paramVal:
                for site in paramVal.split(','):
                    if not sn_rec.match(site):
                        raise ConfigException("The sitename %s dows not look like a valid CMS name (not matching %s)" % (site, sn_re) )
                    result += "&%s=%s" % (siteList, site)
            setattr(self, siteList, result)

        #check the format of jobids
        self.jobids = ''
        if getattr(self.options, 'jobids', None):
            self.jobids = validateJobids(self.options.jobids)
开发者ID:spigad,项目名称:CRABClient,代码行数:33,代码来源:resubmit.py

示例3: validateOptions

    def validateOptions(self):
        """
        After doing the general options validation from the parent SubCommand class,
        do the validation of options that are specific to the submit command.
        """

        ## First call validateOptions() from the SubCommand class.
        SubCommand.validateOptions(self)
        ## If no configuration file was passed as an option, try to extract it from the arguments.
        ## Assume that the arguments can only be:
        ##     1) the configuration file name, and
        ##     2) parameters to override in the configuration file.
        ## The last ones should all contain an '=' sign, so these are not candidates to be the
        ## configuration file argument. Also, the configuration file name should end with '.py'.
        ## If can not find a configuration file candidate, use the default 'crabConfig.py'.
        ## If find more than one candidate, raise ConfigurationException.

        if self.options.config is None:
            use_default = True
            if len(self.args):
                config_candidates = [(arg,i) for i,arg in enumerate(self.args) if '=' not in arg and arg[-3:] == '.py']
                config_candidate_names = set([config_candidate_name for (config_candidate_name,_) in config_candidates])
                if len(config_candidate_names) == 1:
                    self.options.config = config_candidates[0][0]
                    del self.args[config_candidates[0][1]]
                    use_default = False
                elif len(config_candidate_names) > 1:
                    self.logger.info('Unable to unambiguously extract the configuration file from the command-line arguments.')
                    self.logger.info('Possible candidates are: %s' % list(config_candidate_names))
                    raise ConfigurationException('ERROR: Unable to extract configuration file from command-line arguments.')
            if use_default:
                self.options.config = 'crabConfig.py'
开发者ID:khurtado,项目名称:CRABClient,代码行数:32,代码来源:submit.py

示例4: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        #check the format of jobids
        self.jobids = ''
        if getattr(self.options, 'jobids', None):
            self.jobids = validateJobids(self.options.jobids)
开发者ID:khurtado,项目名称:CRABClient,代码行数:7,代码来源:kill.py

示例5: __init__

 def __init__(self, logger, cmdargs=None):
     SubCommand.__init__(self, logger, cmdargs)
     self.phedex = PhEDEx(
         {"cert": self.proxyfilename, "key": self.proxyfilename, "logger": self.logger, "pycurl": True}
     )
     self.lfnsaddprefix = None
     self.filename = None
开发者ID:emaszs,项目名称:CRABClient,代码行数:7,代码来源:checkwrite.py

示例6: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        if self.options.jobid is not None:
            try:
                int(self.options.jobid)
            except ValueError:
               raise ClientException("The --jobid option has to be an integer")
开发者ID:belforte,项目名称:CRABClient,代码行数:8,代码来源:preparelocal.py

示例7: validateOptions

    def validateOptions(self):
        """
        Check if the sitelist parameter is a comma separater list of cms sitenames,
        and put the strings to be passed to the server to self
        """
        SubCommand.validateOptions(self)

        #Checking if the sites provided by the user are valid cmsnames. Doing this because with only the
        #server error handling we get:
        #    Server answered with: Invalid input parameter
        #    Reason is: Incorrect 'siteblacklist' parameter
        #which is not really user friendly.
        #Moreover, I prefer to be independent from Lexicon. I'll the regex here.
        sn_re = "^T[1-3]_[A-Z]{2}(_[A-Za-z0-9]+)+$" #sn_re => SiteName_RegularExpression
        sn_rec = re.compile(sn_re) #sn_rec => SiteName_RegularExpressionCompiled

        self.sitewhitelist = ''
        self.siteblsklist = ''

        for siteList in ['sitewhitelist', 'siteblacklist']:
            result = ''
            paramVal = getattr(self.options, siteList, None)
            if paramVal:
                for site in paramVal.split(','):
                    if not sn_rec.match(site):
                        raise ConfigException("The sitename %s dows not look like a valid CMS name (not matching %s)" % (site, sn_re) )
                    result += "&%s=%s" % (siteList, site)
            setattr(self, siteList, result)

        #check the format of jobids
        self.jobids = ''
        if getattr(self.options, 'jobids', None):
            self.jobids = validateJobids(self.options.jobids)

        # Sanity checks for task sizes.  Limits are purposely fairly generous to provide some level of future-proofing.
        # The server may restrict further.
        self.numcores = None
        if self.options.numcores != None:
            if self.options.numcores < 1 or self.options.numcores > 128:
                raise ConfigException("The number of requested cores (%d) must be between 1 and 128." % (self.options.numcores))
            self.numcores = str(self.options.numcores)

        self.maxjobruntime = None
        if self.options.maxjobruntime != None:
            if self.options.maxjobruntime < 1 or self.options.maxjobruntime > 336:
                raise ConfigException("The requested max job runtime (%d hours) must be between 1 and 336 hours." % self.options.maxjobruntime)
            self.maxjobruntime = str(self.options.maxjobruntime)

        self.maxmemory = None
        if self.options.maxmemory != None:
            if self.options.maxmemory < 30 or self.options.maxmemory > 1024*30:
                raise ConfigException("The requested per-job memory (%d MB) must be between 30 and 30720 MB." % self.options.maxmemory)
            self.maxmemory = str(self.options.maxmemory)

        self.priority = None
        if self.options.priority != None:
            self.priority = str(self.options.priority)
开发者ID:qunox,项目名称:CRABClient,代码行数:57,代码来源:resubmit.py

示例8: validateOptions

    def validateOptions(self):
        """
        After doing the general options validation from the parent SubCommand class,
        do the validation of options that are specific to the submit command.
        """
        ## First do the basic validation in the SubCommand.
        SubCommand.validateOptions(self)

        validateSubmitOptions(self.options, self.args)
开发者ID:emaszs,项目名称:CRABClient,代码行数:9,代码来源:submit.py

示例9: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        if self.options.sitename is None:
            msg  = "%sError%s: Please specify the site where to check the write permissions." % (colors.RED, colors.NORMAL)
            msg += " Use the --site option."
            ex = MissingOptionException(msg)
            ex.missingOption = "sitename"
            raise ex
开发者ID:PerilousApricot,项目名称:CRABClient,代码行数:9,代码来源:checkwrite.py

示例10: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        if self.options.idle and (self.options.long or self.options.summary ):
            raise ConfigurationException("Idle option (-i) conflicts with -u, and -l")
        self.long = self.options.long
        self.json = self.options.json
        self.summary = self.options.summary
        self.idle = self.options.idle
开发者ID:Crabclient,项目名称:CRABClient,代码行数:9,代码来源:status.py

示例11: validateOptions

    def validateOptions(self):
        """
        Check if the output file is given and set as attribute
        """
        SubCommand.validateOptions(self)
        if not re.match('^yes$|^no$', self.options.usedbs):
            raise ConfigurationException("--dbs option only accepts the yes and no values (--dbs=yes or --dbs=no)")
        self.usedbs = 1 if self.options.usedbs=='yes' else 0

        setattr(self, 'outdir', getattr(self.options, 'outdir', None))
开发者ID:PerilousApricot,项目名称:CRABClient,代码行数:10,代码来源:report.py

示例12: __init__

    def __init__(self, logger, cmdargs = None):
        """
        Class constructor.
        """
        ## These parameters are defined in setOptions(). They correspond to what
        ## the user passed in the corresponding command line options.
        self.jobids        = None
        self.sitewhitelist = None
        self.siteblacklist = None

        SubCommand.__init__(self, logger, cmdargs)
开发者ID:cirkovic,项目名称:CRABClient,代码行数:11,代码来源:resubmit.py

示例13: validateOptions

 def validateOptions(self):
     SubCommand.validateOptions(self)
     if self.options.idle and (self.options.long or self.options.summary):
         raise ConfigurationException("Option --idle conflicts with --summary and --long")
     
     if self.options.sort is not None:
         sortOpts = ["state", "site", "runtime", "memory", "cpu", "retries", "waste", "exitcode"]
         if self.options.sort not in sortOpts:
             msg  = "%sError%s:" % (colors.RED, colors.NORMAL)
             msg += " Only the following values are accepted for --sort option: %s" % (sortOpts)
             raise ConfigurationException(msg)
开发者ID:nizamyusli,项目名称:CRABClient,代码行数:11,代码来源:status.py

示例14: validateOptions

    def validateOptions(self):
        SubCommand.validateOptions(self)

        if self.options.idle and (self.options.long or self.options.summary or self.options.publication):
            raise ConfigurationException("Idle option (-i) conflicts with -u, -l, and -p")
        if self.options.publication and (self.options.long or self.options.summary or self.options.idle):
            raise ConfigurationException("Publication option (-p) conflicts with -u, -l, and -i")
        self.long = self.options.long
        self.json = self.options.json
        self.summary = self.options.summary
        self.idle = self.options.idle
        self.publication = self.options.publication
开发者ID:qunox,项目名称:CRABClient,代码行数:12,代码来源:status.py

示例15: __init__

    def __init__(self, logger, cmdargs = None):
        """
        Class constructor.
        """
        self.jobids        = None
        self.sitewhitelist = None
        self.siteblacklist = None
        self.maxjobruntime = None
        self.maxmemory     = None
        self.numcores      = None
        self.priority      = None

        SubCommand.__init__(self, logger, cmdargs)
开发者ID:khurtado,项目名称:CRABClient,代码行数:13,代码来源:resubmit.py


注:本文中的CRABClient.Commands.SubCommand.SubCommand类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。