本文整理汇总了Python中liboozie.submission2.Submission.get_external_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python Submission.get_external_parameters方法的具体用法?Python Submission.get_external_parameters怎么用?Python Submission.get_external_parameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类liboozie.submission2.Submission
的用法示例。
在下文中一共展示了Submission.get_external_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sync_coord_workflow
# 需要导入模块: from liboozie.submission2 import Submission [as 别名]
# 或者: from liboozie.submission2.Submission import get_external_parameters [as 别名]
def sync_coord_workflow(request, job_id):
ParametersFormSet = formset_factory(ParameterForm, extra=0)
job = check_job_access_permission(request, job_id)
check_job_edition_permission(job, request.user)
hue_coord = get_history().get_coordinator_from_config(job.conf_dict)
hue_wf = (hue_coord and hue_coord.workflow) or get_history().get_workflow_from_config(job.conf_dict)
wf_application_path = job.conf_dict.get('wf_application_path') and Hdfs.urlsplit(job.conf_dict['wf_application_path'])[2] or ''
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])
submission = Submission(user=request.user, job=hue_wf, fs=request.fs, jt=request.jt, properties=mapping)
submission._sync_definition(wf_application_path, mapping)
request.info(_('Successfully updated Workflow definition'))
return redirect(reverse('oozie:list_oozie_coordinator', kwargs={'job_id': job_id}))
else:
request.error(_('Invalid submission form: %s' % params_form.errors))
else:
parameters = hue_wf and hue_wf.find_all_parameters() or []
params_dict = dict([(param['name'], param['value']) for param in parameters])
submission = Submission(user=request.user, job=hue_wf, fs=request.fs, jt=request.jt, properties=None)
prev_properties = hue_wf and hue_wf.deployment_dir and \
submission.get_external_parameters(request.fs.join(wf_application_path, hue_wf.XML_FILE_NAME)) or {}
for key, value in params_dict.iteritems():
params_dict[key] = prev_properties[key] if key in prev_properties.keys() else params_dict[key]
initial_params = ParameterForm.get_initial_params(params_dict)
params_form = ParametersFormSet(initial=initial_params)
popup = render('editor2/submit_job_popup.mako', request, {
'params_form': params_form,
'name': _('Job'),
'header': _('Sync Workflow definition?'),
'action': reverse('oozie:sync_coord_workflow', kwargs={'job_id': job_id})
}, force_template=True).content
return JsonResponse(popup, safe=False)