Exemplo n.º 1
0
def make_flock_configs(config_defs, template_str, timestamp, defaults):
    template = Template(template_str)
    json_and_flock = []

    configs = adhoc.enumerate_configurations(config_defs)
    job_id_format = "%%s-%%0%dd" % math.ceil(math.log(len(configs)) / math.log(10))
    job_index = 0

    for config in configs:
        config.update(defaults)
        config["run_id"] = job_id_format % (timestamp, job_index)
        flock = template.render(config)
        json_and_flock.append((config, flock))
        job_index += 1

    return json_and_flock
Exemplo n.º 2
0
def make_flock_configs(config_defs, template_str, timestamp, defaults):
    template = Template(template_str)
    json_and_flock = []

    configs = adhoc.enumerate_configurations(config_defs)
    job_id_format = "%%s-%%0%dd" % math.ceil(math.log(len(configs))/math.log(10))
    job_index = 0

    for config in configs:
        config.update(defaults)
        config["run_id"] = job_id_format % (timestamp, job_index)
        flock = template.render(config)
        json_and_flock.append( (config, flock) )
        job_index += 1

    return json_and_flock
Exemplo n.º 3
0
def job_dashboard():
    filter_tags = request.values.getlist("tag")
    config_name = request.values.get("config_name")

    existing_jobs = get_jobs_from_remote()

    if config_name == "" or config_name == None:
        config = None
        config_name = ""
    else:
        config = CONFIGS[config_name]

    if config != None:
        # compute set of all columns used to define a unique job
        config_property_names = set()
        for x in config:
            config_property_names.update(x.keys())

        all_configs = adhoc.enumerate_configurations(config)
        existing_jobs_parameters = [x['parameters'] for x in existing_jobs]
        existing_jobs_status = dict([ (x['parameters']['run_id'], x['status'])])
        merged = adhoc.find_each_in_a(config_property_names, all_configs, existing_jobs_parameters)
        flattened = adhoc.flatten(merged, existing_jobs_status)
    else:
        flattened = adhoc.from_existing(existing_jobs)

    flattened = adhoc.find_with_tags(flattened, filter_tags)

    summary = adhoc.summarize(flattened)
    for x in ["run_id", "job_dir", "status", "job_name"]:
        if x in summary:
            del summary[x]

    fixed_values, column_names = adhoc.factor_out_common(summary)
    tag_universe = adhoc.get_all_tags(summary)

    return flask.render_template("job-dashboard.html", jobs=flattened,
                                 column_names=column_names, tags=tag_universe,
                                 fixed_values=fixed_values.items(), current_filter_tags=filter_tags,
                                 config_name=config_name, config_names=CONFIGS.keys())