本文整理汇总了Python中oozie.models2.Bundle.find_all_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python Bundle.find_all_parameters方法的具体用法?Python Bundle.find_all_parameters怎么用?Python Bundle.find_all_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.models2.Bundle
的用法示例。
在下文中一共展示了Bundle.find_all_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: submit_bundle
# 需要导入模块: from oozie.models2 import Bundle [as 别名]
# 或者: from oozie.models2.Bundle import find_all_parameters [as 别名]
def submit_bundle(request, doc_id):
bundle = Bundle(document=Document2.objects.get(id=doc_id))
ParametersFormSet = formset_factory(ParameterForm, extra=0)
if request.method == 'POST':
params_form = ParametersFormSet(request.POST)
if params_form.is_valid():
mapping = dict([(param['name'], param['value']) for param in params_form.cleaned_data])
job_id = _submit_bundle(request, bundle, mapping)
jsonify = request.POST.get('format') == 'json'
if jsonify:
return JsonResponse({'status': 0, 'job_id': job_id, 'type': 'bundle'}, safe=False)
else:
request.info(_('Bundle submitted.'))
return redirect(reverse('oozie:list_oozie_bundle', kwargs={'job_id': job_id}))
else:
request.error(_('Invalid submission form: %s' % params_form.errors))
else:
parameters = bundle.find_all_parameters()
initial_params = ParameterForm.get_initial_params(dict([(param['name'], param['value']) for param in parameters]))
params_form = ParametersFormSet(initial=initial_params)
popup = render('editor2/submit_job_popup.mako', request, {
'params_form': params_form,
'name': bundle.name,
'action': reverse('oozie:editor_submit_bundle', kwargs={'doc_id': bundle.id}),
'return_json': request.GET.get('format') == 'json',
'show_dryrun': False
}, force_template=True).content
return JsonResponse(popup, safe=False)