本文整理汇总了Python中oozie.conf.ENABLE_CRON_SCHEDULING.get方法的典型用法代码示例。如果您正苦于以下问题:Python ENABLE_CRON_SCHEDULING.get方法的具体用法?Python ENABLE_CRON_SCHEDULING.get怎么用?Python ENABLE_CRON_SCHEDULING.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.conf.ENABLE_CRON_SCHEDULING
的用法示例。
在下文中一共展示了ENABLE_CRON_SCHEDULING.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_coordinator
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def create_coordinator(request, workflow=None):
if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2", workflow=workflow)
else:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2")
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.method == 'POST':
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
if coordinator_form.is_valid():
coordinator = coordinator_form.save()
if enable_cron_scheduling:
coordinator.cron_frequency = {'frequency': request.POST.get('cron_frequency'), 'isAdvancedCron': request.POST.get('isAdvancedCron') == 'on'}
coordinator.save()
Document.objects.link(coordinator, owner=coordinator.owner, name=coordinator.name, description=coordinator.description)
return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}) + "#step3")
else:
request.error(_('Errors on the form: %s') % coordinator_form.errors)
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
return render('editor/create_coordinator.mako', request, {
'coordinator': coordinator,
'coordinator_form': coordinator_form,
'coordinator_frequency': json.dumps(coordinator.cron_frequency),
'enable_cron_scheduling': enable_cron_scheduling,
})
示例2: list_oozie_coordinators
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinators(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(), 'filters': []}
if not has_dashboard_jobs_access(request.user):
kwargs['filters'].append(('user', request.user.username))
oozie_api = get_oozie(request.user)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.GET.get('format') == 'json':
if request.GET.get('offset'):
kwargs['offset'] = request.GET.get('offset')
json_jobs = []
total_jobs = 0
if request.GET.getlist('status'):
kwargs['filters'].extend([('status', status) for status in request.GET.getlist('status')])
co_list = oozie_api.get_coordinators(**kwargs)
json_jobs = co_list.jobs
total_jobs = co_list.total
if request.GET.get('type') == 'progress':
json_jobs = [oozie_api.get_coordinator(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user)
response['total_jobs'] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render('dashboard/list_oozie_coordinators.mako', request, {
'jobs': [],
'has_job_edition_permission': has_job_edition_permission,
'enable_cron_scheduling': enable_cron_scheduling,
})
示例3: list_oozie_coordinator
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinator(request, job_id):
kwargs = {'cnt': 50, 'filters': []}
kwargs['offset'] = request.GET.get('offset', 1)
if request.GET.getlist('status'):
kwargs['filters'].extend([('status', status) for status in request.GET.getlist('status')])
oozie_coordinator = check_job_access_permission(request, job_id, **kwargs)
# Cross reference the submission history (if any)
coordinator = get_history().get_coordinator_from_config(oozie_coordinator.conf_dict)
try:
if not ENABLE_V2.get():
coordinator = get_history().objects.get(oozie_job_id=job_id).job.get_full_node()
except:
LOG.exception("Ignoring error getting oozie job coordinator for job_id=%s", job_id)
oozie_bundle = None
if request.GET.get('bundle_job_id'):
try:
oozie_bundle = check_job_access_permission(request, request.GET.get('bundle_job_id'))
except:
LOG.exception("Ignoring error getting oozie bundle for job_id=%s", job_id)
if request.GET.get('format') == 'json':
actions = massaged_coordinator_actions_for_json(oozie_coordinator, oozie_bundle)
return_obj = {
'id': oozie_coordinator.id,
'status': oozie_coordinator.status,
'progress': oozie_coordinator.get_progress(),
'nextTime': format_time(oozie_coordinator.nextMaterializedTime),
'endTime': format_time(oozie_coordinator.endTime),
'actions': actions,
'total_actions': oozie_coordinator.total,
'doc_url': coordinator.get_absolute_url() if coordinator else '',
}
return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
oozie_slas = []
if oozie_coordinator.has_sla:
oozie_api = get_oozie(request.user, api_version="v2")
params = {
'id': oozie_coordinator.id,
'parent_id': oozie_coordinator.id
}
oozie_slas = oozie_api.get_oozie_slas(**params)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
update_coord_form = UpdateCoordinatorForm(oozie_coordinator=oozie_coordinator)
return render('dashboard/list_oozie_coordinator.mako', request, {
'oozie_coordinator': oozie_coordinator,
'oozie_slas': oozie_slas,
'coordinator': coordinator,
'oozie_bundle': oozie_bundle,
'has_job_edition_permission': has_job_edition_permission,
'enable_cron_scheduling': enable_cron_scheduling,
'update_coord_form': update_coord_form,
})
示例4: list_oozie_coordinator
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinator(request, job_id):
kwargs = {"cnt": 50, "filters": []}
kwargs["offset"] = request.GET.get("offset", 1)
if request.GET.getlist("status"):
kwargs["filters"].extend([("status", status) for status in request.GET.getlist("status")])
oozie_coordinator = check_job_access_permission(request, job_id, **kwargs)
# Cross reference the submission history (if any)
coordinator = get_history().get_coordinator_from_config(oozie_coordinator.conf_dict)
try:
if not ENABLE_V2.get():
coordinator = get_history().objects.get(oozie_job_id=job_id).job.get_full_node()
except:
LOG.exception("Ignoring error getting oozie job coordinator for job_id=%s", job_id)
oozie_bundle = None
if request.GET.get("bundle_job_id"):
try:
oozie_bundle = check_job_access_permission(request, request.GET.get("bundle_job_id"))
except:
LOG.exception("Ignoring error getting oozie bundle for job_id=%s", job_id)
if request.GET.get("format") == "json":
actions = massaged_coordinator_actions_for_json(oozie_coordinator, oozie_bundle)
return_obj = {
"id": oozie_coordinator.id,
"status": oozie_coordinator.status,
"progress": oozie_coordinator.get_progress(),
"nextTime": format_time(oozie_coordinator.nextMaterializedTime),
"endTime": format_time(oozie_coordinator.endTime),
"actions": actions,
"total_actions": oozie_coordinator.total,
}
return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
oozie_slas = []
if oozie_coordinator.has_sla:
oozie_api = get_oozie(request.user, api_version="v2")
params = {"id": oozie_coordinator.id, "parent_id": oozie_coordinator.id}
oozie_slas = oozie_api.get_oozie_slas(**params)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
update_coord_form = UpdateCoordinatorForm(oozie_coordinator=oozie_coordinator)
return render(
"dashboard/list_oozie_coordinator.mako",
request,
{
"oozie_coordinator": oozie_coordinator,
"oozie_slas": oozie_slas,
"coordinator": coordinator,
"oozie_bundle": oozie_bundle,
"has_job_edition_permission": has_job_edition_permission,
"enable_cron_scheduling": enable_cron_scheduling,
"update_coord_form": update_coord_form,
},
)
示例5: list_oozie_coordinator
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinator(request, job_id):
oozie_coordinator = check_job_access_permission(request, job_id)
# Cross reference the submission history (if any)
coordinator = None
try:
coordinator = History.objects.get(oozie_job_id=job_id).job.get_full_node()
except History.DoesNotExist:
pass
oozie_bundle = None
if request.GET.get('bundle_job_id'):
try:
oozie_bundle = check_job_access_permission(request, request.GET.get('bundle_job_id'))
except:
pass
show_all_actions = request.GET.get('show_all_actions') == 'true'
if request.GET.get('format') == 'json':
actions = massaged_coordinator_actions_for_json(oozie_coordinator, oozie_bundle)
if not show_all_actions:
actions = actions[:MAX_COORD_ACTIONS]
return_obj = {
'id': oozie_coordinator.id,
'status': oozie_coordinator.status,
'progress': oozie_coordinator.get_progress(),
'nextTime': format_time(oozie_coordinator.nextMaterializedTime),
'endTime': format_time(oozie_coordinator.endTime),
'actions': actions,
'show_all_actions': show_all_actions
}
return HttpResponse(encode_json_for_js(return_obj), mimetype="application/json")
oozie_slas = []
if oozie_coordinator.has_sla:
api = get_oozie(request.user, api_version="v2")
params = {
'id': oozie_coordinator.id,
'parent_id': oozie_coordinator.id
}
oozie_slas = api.get_oozie_slas(**params)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
return render('dashboard/list_oozie_coordinator.mako', request, {
'oozie_coordinator': oozie_coordinator,
'oozie_slas': oozie_slas,
'coordinator': coordinator,
'oozie_bundle': oozie_bundle,
'has_job_edition_permission': has_job_edition_permission,
'show_all_actions': show_all_actions,
'MAX_COORD_ACTIONS': MAX_COORD_ACTIONS,
'enable_cron_scheduling': enable_cron_scheduling,
})
示例6: list_coordinators
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_coordinators(request, workflow_id=None):
data = Document.objects.available(Coordinator, request.user)
if workflow_id is not None:
data = [job for job in data if job.workflow.id == workflow_id]
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
return render('editor/list_coordinators.mako', request, {
'jobs': data,
'json_jobs': json.dumps([job.id for job in data]),
'enable_cron_scheduling': enable_cron_scheduling,
})
示例7: list_oozie_coordinators
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinators(request):
kwargs = {'cnt': OOZIE_JOBS_COUNT.get(),}
if not has_dashboard_jobs_access(request.user):
kwargs['user'] = request.user.username
coordinators = get_oozie(request.user).get_coordinators(**kwargs)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.GET.get('format') == 'json':
json_jobs = coordinators.jobs
if request.GET.get('type') == 'running':
json_jobs = split_oozie_jobs(request.user, coordinators.jobs)['running_jobs']
if request.GET.get('type') == 'completed':
json_jobs = split_oozie_jobs(request.user, coordinators.jobs)['completed_jobs']
return HttpResponse(json.dumps(massaged_oozie_jobs_for_json(json_jobs, request.user)).replace('\\\\', '\\'), mimetype="application/json")
return render('dashboard/list_oozie_coordinators.mako', request, {
'jobs': split_oozie_jobs(request.user, coordinators.jobs),
'has_job_edition_permission': has_job_edition_permission,
'enable_cron_scheduling': enable_cron_scheduling,
})
示例8: list_oozie_coordinators
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def list_oozie_coordinators(request):
kwargs = {"cnt": OOZIE_JOBS_COUNT.get(), "filters": []}
if not has_dashboard_jobs_access(request.user):
kwargs["filters"].append(("user", request.user.username))
oozie_api = get_oozie(request.user)
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.GET.get("format") == "json":
if request.GET.get("offset"):
kwargs["offset"] = request.GET.get("offset")
json_jobs = []
total_jobs = 0
if request.GET.getlist("status"):
kwargs["filters"].extend([("status", status) for status in request.GET.getlist("status")])
co_list = oozie_api.get_coordinators(**kwargs)
json_jobs = co_list.jobs
total_jobs = co_list.total
if request.GET.get("type") == "progress":
json_jobs = [oozie_api.get_coordinator(job.id) for job in json_jobs]
response = massaged_oozie_jobs_for_json(json_jobs, request.user)
response["total_jobs"] = total_jobs
return JsonResponse(response, encoder=JSONEncoderForHTML)
return render(
"dashboard/list_oozie_coordinators.mako",
request,
{
"jobs": [],
"has_job_edition_permission": has_job_edition_permission,
"enable_cron_scheduling": enable_cron_scheduling,
},
)
示例9: edit_coordinator
# 需要导入模块: from oozie.conf import ENABLE_CRON_SCHEDULING [as 别名]
# 或者: from oozie.conf.ENABLE_CRON_SCHEDULING import get [as 别名]
def edit_coordinator(request, coordinator):
history = History.objects.filter(submitter=request.user, job=coordinator).order_by('-submission_date')
DatasetFormSet = inlineformset_factory(Coordinator, Dataset, form=DatasetForm, max_num=0, can_order=False, can_delete=True)
DataInputFormSet = inlineformset_factory(Coordinator, DataInput, form=DataInputForm, max_num=0, can_order=False, can_delete=True)
DataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
DataOutputFormSet = inlineformset_factory(Coordinator, DataOutput, form=DataOutputForm, max_num=0, can_order=False, can_delete=True)
DataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
dataset = Dataset(coordinator=coordinator)
dataset_form = DatasetForm(instance=dataset, prefix='create')
NewDataInputFormSet = inlineformset_factory(Coordinator, DataInput, form=DataInputForm, extra=0, can_order=False, can_delete=False)
NewDataInputFormSet.form = staticmethod(curry(DataInputForm, coordinator=coordinator))
NewDataOutputFormSet = inlineformset_factory(Coordinator, DataOutput, form=DataOutputForm, extra=0, can_order=False, can_delete=False)
NewDataOutputFormSet.form = staticmethod(curry(DataOutputForm, coordinator=coordinator))
enable_cron_scheduling = ENABLE_CRON_SCHEDULING.get()
if request.method == 'POST':
coordinator_form = CoordinatorForm(request.POST, instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(request.POST, request.FILES, instance=coordinator)
data_input_formset = DataInputFormSet(request.POST, request.FILES, instance=coordinator)
data_output_formset = DataOutputFormSet(request.POST, request.FILES, instance=coordinator)
new_data_input_formset = NewDataInputFormSet(request.POST, request.FILES, instance=coordinator, prefix='input')
new_data_output_formset = NewDataOutputFormSet(request.POST, request.FILES, instance=coordinator, prefix='output')
if coordinator_form.is_valid() and dataset_formset.is_valid() and data_input_formset.is_valid() and data_output_formset.is_valid() \
and new_data_input_formset.is_valid() and new_data_output_formset.is_valid():
coordinator = coordinator_form.save()
dataset_formset.save()
data_input_formset.save()
data_output_formset.save()
new_data_input_formset.save()
new_data_output_formset.save()
coordinator.sla = json.loads(request.POST.get('sla'))
if enable_cron_scheduling:
coordinator.cron_frequency = {'frequency': request.POST.get('cron_frequency'), 'isAdvancedCron': request.POST.get('isAdvancedCron') == 'on'}
coordinator.save()
request.info(_('Coordinator saved.'))
return redirect(reverse('oozie:edit_coordinator', kwargs={'coordinator': coordinator.id}))
else:
coordinator_form = CoordinatorForm(instance=coordinator, user=request.user)
dataset_formset = DatasetFormSet(instance=coordinator)
data_input_formset = DataInputFormSet(instance=coordinator)
data_output_formset = DataOutputFormSet(instance=coordinator)
new_data_input_formset = NewDataInputFormSet(queryset=DataInput.objects.none(), instance=coordinator, prefix='input')
new_data_output_formset = NewDataOutputFormSet(queryset=DataOutput.objects.none(), instance=coordinator, prefix='output')
return render('editor/edit_coordinator.mako', request, {
'coordinator': coordinator,
'coordinator_form': coordinator_form,
'dataset_formset': dataset_formset,
'data_input_formset': data_input_formset,
'data_output_formset': data_output_formset,
'dataset': dataset,
'dataset_form': dataset_form,
'new_data_input_formset': new_data_input_formset,
'new_data_output_formset': new_data_output_formset,
'history': history,
'coordinator_frequency': json.dumps(coordinator.cron_frequency),
'enable_cron_scheduling': enable_cron_scheduling,
})