def job(request):
    """View for a single job."""
    job_id = request.GET.get("job_id")
    recent_jobs = JobRecord.objects.order_by("-start_time")[0:100]
    recent_trials = TrialRecord.objects \
        .filter(job_id=job_id) \
        .order_by("-start_time")
    trial_records = []
    for recent_trial in recent_trials:
        trial_records.append(get_trial_info(recent_trial))
    current_job = JobRecord.objects \
        .filter(job_id=job_id) \
        .order_by("-start_time")[0]

    if len(trial_records) > 0:
        param_keys = trial_records[0]["params"].keys()
    else:
        param_keys = []

    # TODO: support custom metrics here
    metric_keys = ["episode_reward", "accuracy", "loss"]
    context = {
        "current_job": get_job_info(current_job),
        "recent_jobs": recent_jobs,
        "recent_trials": trial_records,
        "param_keys": param_keys,
        "param_num": len(param_keys),
        "metric_keys": metric_keys,
        "metric_num": len(metric_keys)
    }
    return render(request, "job.html", context)
def job ( request ) : job_id = request . GET . get ( "job_id" ) recent_jobs = JobRecord . objects . order_by ( "-start_time" ) [ 0 : 100 ] recent_trials = TrialRecord . objects . filter ( job_id = job_id ) . order_by ( "-start_time" ) trial_records = [ ] for recent_trial in recent_trials : trial_records . append ( get_trial_info ( recent_trial ) ) current_job = JobRecord . objects . filter ( job_id = job_id ) . order_by ( "-start_time" ) [ 0 ] if len ( trial_records ) > 0 : param_keys = trial_records [ 0 ] [ "params" ] . keys ( ) else : param_keys = [ ] metric_keys = [ "episode_reward" , "accuracy" , "loss" ] context = { "current_job" : get_job_info ( current_job ) , "recent_jobs" : recent_jobs , "recent_trials" : trial_records , "param_keys" : param_keys , "param_num" : len ( param_keys ) , "metric_keys" : metric_keys , "metric_num" : len ( metric_keys ) } return render ( request , "job.html" , context )
View for a single job.