yandextank/stepper/main.py
def __get_stpd_filename(self):
        ''' Choose the name for stepped data file '''
        if self.use_caching:
            sep = "|"
            hasher = hashlib.md5()
            hashed_str = "cache version 6" + sep + \
                ';'.join(self.load_profile.schedule) + sep + str(self.loop_limit)
            hashed_str += sep + str(self.ammo_limit) + sep + ';'.join(
                self.load_profile.schedule) + sep + str(self.autocases)
            hashed_str += sep + ";".join(self.uris) + sep + ";".join(
                self.headers) + sep + self.http_ver + sep + ";".join(
                    self.chosen_cases)
            hashed_str += sep + str(self.enum_ammo) + sep + str(self.ammo_type)
            if self.load_profile.is_instances():
                hashed_str += sep + str(self.instances)
            if self.ammo_file:
                opener = resource.get_opener(self.ammo_file)
                hashed_str += sep + opener.hash
            else:
                if not self.uris:
                    raise RuntimeError("Neither ammofile nor uris specified")
                hashed_str += sep + \
                    ';'.join(self.uris) + sep + ';'.join(self.headers)
            self.log.debug("stpd-hash source: %s", hashed_str)
            hasher.update(hashed_str.encode('utf8'))
            if not os.path.exists(self.cache_dir):
                os.makedirs(self.cache_dir)
            stpd = self.cache_dir + '/' + \
                os.path.basename(self.ammo_file) + \
                "_" + hasher.hexdigest() + ".stpd"
        else:
            stpd = os.path.realpath("ammo.stpd")
        self.log.debug("Generated cache file name: %s", stpd)
        return stpd
def __get_stpd_filename(self):
        ''' Choose the name for stepped data file '''
        if self.use_caching:
            sep = "|"
            hasher = hashlib.md5()
            hashed_str = "cache version 6" + sep + \
                ';'.join(self.load_profile.schedule) + sep + str(self.loop_limit)
            hashed_str += sep + str(self.ammo_limit) + sep + ';'.join(
                self.load_profile.schedule) + sep + str(self.autocases)
            hashed_str += sep + ";".join(self.uris) + sep + ";".join(
                self.headers) + sep + self.http_ver + sep + ";".join(
                    self.chosen_cases)
            hashed_str += sep + str(self.enum_ammo) + sep + str(self.ammo_type)
            if self.load_profile.is_instances():
                hashed_str += sep + str(self.instances)
            if self.ammo_file:
                opener = resource.get_opener(self.ammo_file)
                hashed_str += sep + opener.hash
            else:
                if not self.uris:
                    raise RuntimeError("Neither ammofile nor uris specified")
                hashed_str += sep + \
                    ';'.join(self.uris) + sep + ';'.join(self.headers)
            self.log.debug("stpd-hash source: %s", hashed_str)
            hasher.update(hashed_str.encode('utf8'))
            if not os.path.exists(self.cache_dir):
                os.makedirs(self.cache_dir)
            stpd = self.cache_dir + '/' + \
                os.path.basename(self.ammo_file) + \
                "_" + hasher.hexdigest() + ".stpd"
        else:
            stpd = os.path.realpath("ammo.stpd")
        self.log.debug("Generated cache file name: %s", stpd)
        return stpd
def __get_stpd_filename ( self ) : if self . use_caching : sep = "|" hasher = hashlib . md5 ( ) hashed_str = "cache version 6" + sep + ';' . join ( self . load_profile . schedule ) + sep + str ( self . loop_limit ) hashed_str += sep + str ( self . ammo_limit ) + sep + ';' . join ( self . load_profile . schedule ) + sep + str ( self . autocases ) hashed_str += sep + ";" . join ( self . uris ) + sep + ";" . join ( self . headers ) + sep + self . http_ver + sep + ";" . join ( self . chosen_cases ) hashed_str += sep + str ( self . enum_ammo ) + sep + str ( self . ammo_type ) if self . load_profile . is_instances ( ) : hashed_str += sep + str ( self . instances ) if self . ammo_file : opener = resource . get_opener ( self . ammo_file ) hashed_str += sep + opener . hash else : if not self . uris : raise RuntimeError ( "Neither ammofile nor uris specified" ) hashed_str += sep + ';' . join ( self . uris ) + sep + ';' . join ( self . headers ) self . log . debug ( "stpd-hash source: %s" , hashed_str ) hasher . update ( hashed_str . encode ( 'utf8' ) ) if not os . path . exists ( self . cache_dir ) : os . makedirs ( self . cache_dir ) stpd = self . cache_dir + '/' + os . path . basename ( self . ammo_file ) + "_" + hasher . hexdigest ( ) + ".stpd" else : stpd = os . path . realpath ( "ammo.stpd" ) self . log . debug ( "Generated cache file name: %s" , stpd ) return stpd
Choose the name for stepped data file
Choose the name for stepped data file