Пример #1
0
def MRform(request, experiment_id):
    """
    setup of a new MR process overview
    :param experiment_id: experiment id of current experiment
    :type experiment_id: integer
    :returns: overview page corresponding to dataset submitted via POST
        using mrtardis/MRform.html template
    """
    # logger.debug(repr(request.POST))
    if "action" not in request.POST:
        return HttpResponseNotFound("<h1>Wrong use of function</h1>")
    action = request.POST["action"]
    if action == "newDS":
        newMRtask = MRtask(description=request.POST["description"], experiment_id=experiment_id)
        newMRtask.set_status("unsubmitted")
        dataset = newMRtask.dataset
    elif action == "continue":
        dataset = Dataset.objects.get(pk=int(request.POST["dataset"]))
        pass  # load existing parameters into form
    elif action == "rerunDS":
        olddataset = Dataset.objects.get(pk=request.POST["dataset"])
        oldMRtask = MRtask(dataset=olddataset)
        newMRtask = MRtask.clone(
            oldInstance=oldMRtask, newDescription=request.POST["description"], username=request.user.username
        )
        newMRtask.set_status("unsubmitted")
        dataset = newMRtask.dataset
        pass  # run new MR based on finished one
    if "message" in request.POST:
        message = request.POST["message"]
    else:
        message = ""
    DSfileSelectChoices = [
        (otherDataset.id, otherDataset.description)
        for otherDataset in Dataset.objects.filter(experiment__pk=experiment_id)
        if otherDataset.id != dataset.id
    ]
    datasetSelectForm = selectDSForm(DSfileSelectChoices)
    c = Context(
        {"message": message, "dataset": dataset, "experiment_id": experiment_id, "datasetSelectForm": datasetSelectForm}
    )
    return render_to_response("mrtardis/MRform.html", c)
Пример #2
0
    try:
        hpc_username = test_hpc_connection(request.user)
    except Exception, e:
        hpc_error = e

    newDSForm = DatasetDescriptionForm()

    def getChoices(status):
        return [
            (mytask.dataset.id, mytask.dataset.description)
            for mytask in MRtask.getTaskList(experiment_id, status=status)
        ]

    continueChoices = getChoices("unsubmitted")
    if continueChoices:
        continueForm = selectDSForm(continueChoices)
    else:
        continueForm = False
    viewFormChoices = getChoices("finished")
    if viewFormChoices:
        viewForm = selectDSForm(viewFormChoices)
    else:
        viewForm = False
    rerunFormChoices = getChoices("finished")
    if rerunFormChoices:
        rerunForm = selectDSForm(rerunFormChoices)
    else:
        rerunForm = False

    c = {
        "newDSForm": newDSForm,