yandextank/api/apiworker.py
def configure(self, options):
        """ Make preparations before running Tank """
        self.options = options
        if self.options.get('lock_dir', None):
            self.core.set_option(self.core.SECTION, "lock_dir", self.options['lock_dir'])
        if self.options.get('ignore_lock', None):
            self.core.set_option(self.core.SECTION, 'ignore_lock', self.options['ignore_lock'])

        while True:
            try:
                self.core.get_lock()
                break
            except Exception as exc:
                if self.options.get('lock_fail', None):
                    raise RuntimeError("Lock file present, cannot continue")
                self.log.info(
                    "Couldn't get lock. Will retry in 5 seconds... (%s)",
                    str(exc))
                time.sleep(5)

        configs = self.get_default_configs()
        if self.options.get('config', None):
            configs.append(self.options['config'])
        self.core.load_configs(configs)
        self.__add_user_options()
        self.core.load_plugins()

        if self.options.get('ignore_lock', None):
            self.core.set_option(self.core.SECTION, self.IGNORE_LOCKS, "1")
def configure(self, options):
        self.options = options
        if self.options.get('lock_dir', None):
            self.core.set_option(self.core.SECTION, "lock_dir", self.options['lock_dir'])
        if self.options.get('ignore_lock', None):
            self.core.set_option(self.core.SECTION, 'ignore_lock', self.options['ignore_lock'])

        while True:
            try:
                self.core.get_lock()
                break
            except Exception as exc:
                if self.options.get('lock_fail', None):
                    raise RuntimeError("Lock file present, cannot continue")
                self.log.info(
                    "Couldn't get lock. Will retry in 5 seconds... (%s)",
                    str(exc))
                time.sleep(5)

        configs = self.get_default_configs()
        if self.options.get('config', None):
            configs.append(self.options['config'])
        self.core.load_configs(configs)
        self.__add_user_options()
        self.core.load_plugins()

        if self.options.get('ignore_lock', None):
            self.core.set_option(self.core.SECTION, self.IGNORE_LOCKS, "1")
def configure ( self , options ) : self . options = options if self . options . get ( 'lock_dir' , None ) : self . core . set_option ( self . core . SECTION , "lock_dir" , self . options [ 'lock_dir' ] ) if self . options . get ( 'ignore_lock' , None ) : self . core . set_option ( self . core . SECTION , 'ignore_lock' , self . options [ 'ignore_lock' ] ) while True : try : self . core . get_lock ( ) break except Exception as exc : if self . options . get ( 'lock_fail' , None ) : raise RuntimeError ( "Lock file present, cannot continue" ) self . log . info ( "Couldn't get lock. Will retry in 5 seconds... (%s)" , str ( exc ) ) time . sleep ( 5 ) configs = self . get_default_configs ( ) if self . options . get ( 'config' , None ) : configs . append ( self . options [ 'config' ] ) self . core . load_configs ( configs ) self . __add_user_options ( ) self . core . load_plugins ( ) if self . options . get ( 'ignore_lock' , None ) : self . core . set_option ( self . core . SECTION , self . IGNORE_LOCKS , "1" )
Make preparations before running Tank
Make preparations before running Tank