Exemple #1
0
def edit_workflow(request, workflow):
    history = History.objects.filter(submitter=request.user,
                                     job=workflow).order_by('-submission_date')
    workflow_form = WorkflowForm(instance=workflow)
    user_can_access_job = workflow.is_accessible(request.user)
    user_can_edit_job = workflow.is_editable(request.user)

    return render(
        'editor/edit_workflow.mako', request, {
            'workflow_form':
            workflow_form,
            'workflow':
            workflow,
            'history':
            history,
            'user_can_access_job':
            user_can_access_job,
            'user_can_edit_job':
            user_can_edit_job,
            'job_properties':
            extract_field_data(workflow_form['job_properties']),
            'link_form':
            LinkForm(),
            'default_link_form':
            DefaultLinkForm(action=workflow.start),
            'node_form':
            NodeForm(),
            'action_forms':
            [(node_type, design_form_by_type(node_type, request.user,
                                             workflow)())
             for node_type in ACTION_TYPES.iterkeys()]
        })
Exemple #2
0
def edit_workflow(request, workflow):
    history = History.objects.filter(submitter=request.user, job=workflow).order_by("-submission_date")
    workflow_form = WorkflowForm(instance=workflow)
    user_can_access_job = workflow.is_accessible(request.user)
    user_can_edit_job = workflow.is_editable(request.user)

    return render(
        "editor/edit_workflow.mako",
        request,
        {
            "workflow_form": workflow_form,
            "workflow": workflow,
            "history": history,
            "user_can_access_job": user_can_access_job,
            "user_can_edit_job": user_can_edit_job,
            "job_properties": extract_field_data(workflow_form["job_properties"]),
            "link_form": LinkForm(),
            "default_link_form": DefaultLinkForm(action=workflow.start),
            "node_form": NodeForm(),
            "action_forms": [
                (node_type, design_form_by_type(node_type, request.user, workflow)())
                for node_type in ACTION_TYPES.iterkeys()
            ],
        },
    )
Exemple #3
0
def validate_json_node(json):
  assert 'id' in json, "Member 'id' not in node."
  assert 'node_type' in json, "Member 'node_type' not in node."
  if json['node_type'] in ACTION_TYPES.keys():
    assert 'name' in json, "Member 'name' not in node."
    # assert 'description' in json, "Member 'description' not in node."
  if 'child_links' not in json:
    raise AssertionError("Member 'child_links' is missing.")

  validate_json_links(json['child_links'])
Exemple #4
0
def edit_workflow(request, workflow):
  history = History.objects.filter(submitter=request.user, job=workflow).order_by('-submission_date')
  workflow_form = WorkflowForm(instance=workflow)
  user_can_edit_job = workflow.is_editable(request.user)

  return render('editor/edit_workflow.mako', request, {
    'workflow_form': workflow_form,
    'workflow': workflow,
    'history': history,
    'user_can_edit_job': user_can_edit_job,
    'job_properties': extract_field_data(workflow_form['job_properties']),
    'link_form': LinkForm(),
    'default_link_form': DefaultLinkForm(action=workflow.start),
    'action_forms': [(node_type, design_form_by_type(node_type, request.user, workflow)())
                     for node_type in ACTION_TYPES.iterkeys()]
  })
Exemple #5
0
def edit_workflow(request, workflow):
    history = History.objects.filter(submitter=request.user,
                                     job=workflow).order_by('-submission_date')
    workflow_form = WorkflowForm(instance=workflow)
    user_can_access_job = workflow.can_read(request.user)
    user_can_edit_job = workflow.is_editable(request.user)
    oozie_api = get_oozie(request.user)
    credentials = Credentials()
    credentials.fetch(oozie_api)

    return render(
        'editor/edit_workflow.mako', request, {
            'oozie_api':
            oozie_api,
            'workflow_form':
            workflow_form,
            'workflow':
            workflow,
            'history':
            history,
            'user_can_access_job':
            user_can_access_job,
            'user_can_edit_job':
            user_can_edit_job,
            'job_properties':
            extract_field_data(workflow_form['job_properties']),
            'link_form':
            LinkForm(),
            'default_link_form':
            DefaultLinkForm(action=workflow.start),
            'node_form':
            NodeForm(),
            'action_forms':
            [(node_type, design_form_by_type(node_type, request.user,
                                             workflow)())
             for node_type in ACTION_TYPES.keys()],
            'credentials':
            json.dumps(list(credentials.credentials.keys()))
        })
Exemple #6
0
def edit_workflow(request, workflow):
  history = History.objects.filter(submitter=request.user, job=workflow).order_by('-submission_date')
  workflow_form = WorkflowForm(instance=workflow)
  user_can_access_job = workflow.can_read(request.user)
  user_can_edit_job = workflow.is_editable(request.user)
  api = get_oozie(request.user)
  credentials = Credentials()
  credentials.fetch(api)

  return render('editor/edit_workflow.mako', request, {
    'workflow_form': workflow_form,
    'workflow': workflow,
    'history': history,
    'user_can_access_job': user_can_access_job,
    'user_can_edit_job': user_can_edit_job,
    'job_properties': extract_field_data(workflow_form['job_properties']),
    'link_form': LinkForm(),
    'default_link_form': DefaultLinkForm(action=workflow.start),
    'node_form': NodeForm(),
    'action_forms': [(node_type, design_form_by_type(node_type, request.user, workflow)())
                     for node_type in ACTION_TYPES.iterkeys()],
    'credentials': json.dumps(credentials.credentials.keys())
  })