當前位置: 首頁>>代碼示例>>Python>>正文


Python RerunCoordForm.is_valid方法代碼示例

本文整理匯總了Python中oozie.forms.RerunCoordForm.is_valid方法的典型用法代碼示例。如果您正苦於以下問題:Python RerunCoordForm.is_valid方法的具體用法?Python RerunCoordForm.is_valid怎麽用?Python RerunCoordForm.is_valid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oozie.forms.RerunCoordForm的用法示例。


在下文中一共展示了RerunCoordForm.is_valid方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: rerun_oozie_coordinator

# 需要導入模塊: from oozie.forms import RerunCoordForm [as 別名]
# 或者: from oozie.forms.RerunCoordForm import is_valid [as 別名]
def rerun_oozie_coordinator(request, job_id, app_path=None):
  oozie_coordinator = check_job_access_permission(request, job_id)
  check_job_edition_permission(oozie_coordinator, request.user)
  ParametersFormSet = formset_factory(ParameterForm, extra=0)
  if app_path is None:
    app_path = oozie_coordinator.coordJobPath
  return_json = request.GET.get('format') == 'json'

  if request.method == 'POST':
    params_form = ParametersFormSet(request.POST)
    rerun_form = RerunCoordForm(request.POST, oozie_coordinator=oozie_coordinator)

    if sum([rerun_form.is_valid(), params_form.is_valid()]) == 2:
      args = {}
      args['deployment_dir'] = app_path

      params = {
        'type': 'action',
        'scope': ','.join(oozie_coordinator.aggreate(rerun_form.cleaned_data['actions'])),
        'refresh': rerun_form.cleaned_data['refresh'],
        'nocleanup': rerun_form.cleaned_data['nocleanup'],
      }

      properties = dict([(param['name'], param['value']) for param in params_form.cleaned_data])

      _rerun_coordinator(request, job_id, args, params, properties)

      if rerun_form.cleaned_data['return_json']:
        return JsonResponse({'status': 0, 'job_id': job_id}, safe=False)
      else:
        request.info(_('Coordinator re-running.'))
        return redirect(reverse('oozie:list_oozie_coordinator', kwargs={'job_id': job_id}))
    else:
      request.error(_('Invalid submission form: %s') % smart_unicode(rerun_form.errors))
      return list_oozie_coordinator(request, job_id)
  else:
    rerun_form = RerunCoordForm(oozie_coordinator=oozie_coordinator, return_json=return_json)
    initial_params = ParameterForm.get_initial_params(oozie_coordinator.conf_dict)
    params_form = ParametersFormSet(initial=initial_params)

  popup = render('dashboard/rerun_coord_popup.mako', request, {
                   'rerun_form': rerun_form,
                   'params_form': params_form,
                   'action': reverse('oozie:rerun_oozie_coord', kwargs={'job_id': job_id, 'app_path': app_path}),
                   'return_json': return_json,
                   'is_mini': request.GET.get('is_mini', False),
                 }, force_template=True).content

  return JsonResponse(popup, safe=False)
開發者ID:cloudera,項目名稱:hue,代碼行數:51,代碼來源:dashboard.py

示例2: rerun_oozie_coordinator

# 需要導入模塊: from oozie.forms import RerunCoordForm [as 別名]
# 或者: from oozie.forms.RerunCoordForm import is_valid [as 別名]
def rerun_oozie_coordinator(request, job_id, app_path):
    oozie_coordinator = check_job_access_permission(request, job_id)
    check_job_edition_permission(oozie_coordinator, request.user)
    ParametersFormSet = formset_factory(ParameterForm, extra=0)

    if request.method == "POST":
        params_form = ParametersFormSet(request.POST)
        rerun_form = RerunCoordForm(request.POST, oozie_coordinator=oozie_coordinator)

        if sum([rerun_form.is_valid(), params_form.is_valid()]) == 2:
            args = {}
            args["deployment_dir"] = app_path

            params = {
                "type": "action",
                "scope": ",".join(oozie_coordinator.aggreate(rerun_form.cleaned_data["actions"])),
                "refresh": rerun_form.cleaned_data["refresh"],
                "nocleanup": rerun_form.cleaned_data["nocleanup"],
            }

            properties = dict([(param["name"], param["value"]) for param in params_form.cleaned_data])

            _rerun_coordinator(request, job_id, args, params, properties)

            request.info(_("Coordinator re-running."))
            return redirect(reverse("oozie:list_oozie_coordinator", kwargs={"job_id": job_id}))
        else:
            request.error(_("Invalid submission form: %s") % smart_unicode(rerun_form.errors))
            return list_oozie_coordinator(request, job_id)
    else:
        rerun_form = RerunCoordForm(oozie_coordinator=oozie_coordinator)
        initial_params = ParameterForm.get_initial_params(oozie_coordinator.conf_dict)
        params_form = ParametersFormSet(initial=initial_params)

    popup = render(
        "dashboard/rerun_coord_popup.mako",
        request,
        {
            "rerun_form": rerun_form,
            "params_form": params_form,
            "action": reverse("oozie:rerun_oozie_coord", kwargs={"job_id": job_id, "app_path": app_path}),
        },
        force_template=True,
    ).content

    return JsonResponse(popup, safe=False)
開發者ID:shobull,項目名稱:hue,代碼行數:48,代碼來源:dashboard.py

示例3: rerun_oozie_coordinator

# 需要導入模塊: from oozie.forms import RerunCoordForm [as 別名]
# 或者: from oozie.forms.RerunCoordForm import is_valid [as 別名]
def rerun_oozie_coordinator(request, job_id, app_path):
  oozie_coordinator = check_job_access_permission(request, job_id)
  check_job_edition_permission(oozie_coordinator, request.user)
  ParametersFormSet = formset_factory(ParameterForm, extra=0)

  if request.method == 'POST':
    params_form = ParametersFormSet(request.POST)
    rerun_form = RerunCoordForm(request.POST, oozie_coordinator=oozie_coordinator)

    if sum([rerun_form.is_valid(), params_form.is_valid()]) == 2:
      args = {}
      args['deployment_dir'] = app_path

      params = {
        'type': 'action',
        'scope': ','.join(oozie_coordinator.aggreate(rerun_form.cleaned_data['actions'])),
        'refresh': rerun_form.cleaned_data['refresh'],
        'nocleanup': rerun_form.cleaned_data['nocleanup'],
      }

      properties = dict([(param['name'], param['value']) for param in params_form.cleaned_data])

      _rerun_coordinator(request, job_id, args, params, properties)

      request.info(_('Coordinator re-running!'))
      return redirect(reverse('oozie:list_oozie_coordinator', kwargs={'job_id': job_id}))
    else:
      request.error(_('Invalid submission form: %s' % (rerun_form.errors,)))
      return list_oozie_coordinator(request, job_id)
  else:
    rerun_form = RerunCoordForm(oozie_coordinator=oozie_coordinator)
    initial_params = ParameterForm.get_initial_params(oozie_coordinator.conf_dict)
    params_form = ParametersFormSet(initial=initial_params)

  popup = render('dashboard/rerun_coord_popup.mako', request, {
                   'rerun_form': rerun_form,
                   'params_form': params_form,
                   'action': reverse('oozie:rerun_oozie_coord', kwargs={'job_id': job_id, 'app_path': app_path}),
                 }, force_template=True).content

  return HttpResponse(json.dumps(popup), mimetype="application/json")
開發者ID:blue68,項目名稱:hue,代碼行數:43,代碼來源:dashboard.py


注:本文中的oozie.forms.RerunCoordForm.is_valid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。