本文整理匯總了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)