本文整理汇总了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)
示例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)
示例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")