(inputfile)
return metrics
Generate metric timeseries data from an experimental design .yaml file

    The format of this file should be:
    metric_type:
      metric_name:
        start_time: XXXX
        end_time: YYYY
        dict_keys: <AWS market specifiction> (optional)
        frequency: <frequency specification>
        values: <values specification>

    This will generate a set of metric values between XXXX and YYYY, with the interarrival
    time between events meeting the frequency specification and the metric values corresponding
    to the values specification. When frequency is specified as historical, this will use the
    data in database (aws_region should be provided as a value parameter) to generate timeseries
    data.

    :returns: a dictionary of metric_type -> (metric_name -> timeseries data)
Generate metric timeseries data from an experimental design .yaml file
Generate metric timeseries data from an experimental design . yaml file
def load_experimental_design(inputfile):
    """ Generate metric timeseries data from an experimental design .yaml file

    The format of this file should be:
    metric_type:
      metric_name:
        start_time: XXXX
        end_time: YYYY
        dict_keys: <AWS market specifiction> (optional)
        frequency: <frequency specification>
        values: <values specification>

    This will generate a set of metric values between XXXX and YYYY, with the interarrival
    time between events meeting the frequency specification and the metric values corresponding
    to the values specification. When frequency is specified as historical, this will use the
    data in database (aws_region should be provided as a value parameter) to generate timeseries
    data.

    :returns: a dictionary of metric_type -> (metric_name -> timeseries data)
    """
    with open(inputfile) as f:
        design = yaml.safe_load(f.read())

    metrics = {}
    for metric_type, metric_design in design.items():
        metrics[metric_type] = defaultdict(list)
        for metric_name, config in metric_design.items():
            start_time = parse_time_string(config["start_time"])
            end_time = parse_time_string(config["end_time"])

            if config["frequency"] == "historical":
                metrics[metric_type][metric_name] = get_historical_data(
                    metric_name, metric_type, config, start_time, end_time
                )
            else:
                metrics[metric_type][metric_name] = get_random_data(config, start_time, end_time)

    return metrics
def load_experimental_design ( inputfile ) : with open ( inputfile ) as f : design = yaml . safe_load ( f . read ( ) ) metrics = { } for metric_type , metric_design in design . items ( ) : metrics [ metric_type ] = defaultdict ( list ) for metric_name , config in metric_design . items ( ) : start_time = parse_time_string ( config [ "start_time" ] ) end_time = parse_time_string ( config [ "end_time" ] ) if config [ "frequency" ] == "historical" : metrics [ metric_type ] [ metric_name ] = get_historical_data ( metric_name , metric_type , config , start_time , end_time ) else : metrics [ metric_type ] [ metric_name ] = get_random_data ( config , start_time , end_time ) return metrics