def calc_expected_rps(fire, started_at=None): '''Calculate theoretical request per second sequinse. Args: fire: dict, current fire(job) options. Returns: result: list of tuples. ''' result = [] #try: # offset = int(fire['started_at']) #except TypeError: # exit_err('Can\'t parse fire *started_at* attribute, config malformed.') offset = fire.get('started_at', None) if not offset and started_at: offset = started_at else: exit_err('Can\'t parse fire *started_at* attribute, config malformed.') offset = int(offset) for schema in fire['load']: series = series_from_schema(schema, offset) result.extend(series) offset = series[-1][0] + 1 return result
def get_calc_load_series(fire): '''Calculate theoretical request per second sequinse. Args: fire: dict, current fire(job) options. Returns: result: list of tuples. ''' result = [] try: offset = int(fire['started_at']) except TypeError: exit_err('Can\'t parse fire *started_at* attribute, config malformed.') for schema in fire['load']: __series = series_from_schema(schema, offset) result.extend(__series) offset = __series[-1][0] + 1 return result