本文整理汇总了Python中oozie.models.Workflow.gen_status_graph_from_xml方法的典型用法代码示例。如果您正苦于以下问题:Python Workflow.gen_status_graph_from_xml方法的具体用法?Python Workflow.gen_status_graph_from_xml怎么用?Python Workflow.gen_status_graph_from_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oozie.models.Workflow
的用法示例。
在下文中一共展示了Workflow.gen_status_graph_from_xml方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: list_oozie_workflow
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import gen_status_graph_from_xml [as 别名]
def list_oozie_workflow(request, job_id, coordinator_job_id=None):
oozie_workflow = check_job_access_permission(request, job_id)
oozie_coordinator = None
if coordinator_job_id is not None:
oozie_coordinator = check_job_access_permission(request, coordinator_job_id)
history = History.cross_reference_submission_history(request.user, job_id, coordinator_job_id)
hue_coord = history and history.get_coordinator() or History.get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or (history and history.get_workflow()) or History.get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord: Job.objects.is_accessible_or_exception(request, hue_coord.workflow.id)
if hue_workflow: Job.objects.is_accessible_or_exception(request, hue_workflow.id)
parameters = oozie_workflow.conf_dict.copy()
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
else:
workflow_graph = Workflow.gen_status_graph_from_xml(request.user, oozie_workflow)
return render('dashboard/list_oozie_workflow.mako', request, {
'history': history,
'oozie_workflow': oozie_workflow,
'oozie_coordinator': oozie_coordinator,
'hue_workflow': hue_workflow,
'hue_coord': hue_coord,
'parameters': parameters,
'has_job_edition_permission': has_job_edition_permission,
'workflow_graph': workflow_graph
})
示例2: list_oozie_workflow
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import gen_status_graph_from_xml [as 别名]
def list_oozie_workflow(request, job_id, coordinator_job_id=None, bundle_job_id=None):
oozie_workflow = check_job_access_permission(request, job_id)
oozie_coordinator = None
if coordinator_job_id is not None:
oozie_coordinator = check_job_access_permission(request, coordinator_job_id)
oozie_bundle = None
if bundle_job_id is not None:
oozie_bundle = check_job_access_permission(request, bundle_job_id)
if oozie_coordinator is not None:
setattr(oozie_workflow, 'oozie_coordinator', oozie_coordinator)
if oozie_bundle is not None:
setattr(oozie_workflow, 'oozie_bundle', oozie_bundle)
history = History.cross_reference_submission_history(request.user, job_id, coordinator_job_id)
hue_coord = history and history.get_coordinator() or History.get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or (history and history.get_workflow()) or History.get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord: Job.objects.is_accessible_or_exception(request, hue_coord.workflow.id)
if hue_workflow: Job.objects.is_accessible_or_exception(request, hue_workflow.id)
parameters = oozie_workflow.conf_dict.copy()
for action in oozie_workflow.actions:
action.oozie_coordinator = oozie_coordinator
action.oozie_bundle = oozie_bundle
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
full_node_list = hue_workflow.node_list
else:
workflow_graph, full_node_list = Workflow.gen_status_graph_from_xml(request.user, oozie_workflow)
if request.GET.get('format') == 'json':
return_obj = {
'id': oozie_workflow.id,
'status': oozie_workflow.status,
'progress': oozie_workflow.get_progress(full_node_list),
'graph': workflow_graph,
'log': oozie_workflow.log,
'actions': massaged_workflow_actions_for_json(oozie_workflow.get_working_actions(), oozie_coordinator, oozie_bundle)
}
return HttpResponse(encode_json_for_js(return_obj), mimetype="application/json")
return render('dashboard/list_oozie_workflow.mako', request, {
'history': history,
'oozie_workflow': oozie_workflow,
'oozie_coordinator': oozie_coordinator,
'oozie_bundle': oozie_bundle,
'hue_workflow': hue_workflow,
'hue_coord': hue_coord,
'parameters': parameters,
'has_job_edition_permission': has_job_edition_permission,
'workflow_graph': workflow_graph
})
示例3: list_oozie_workflow
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import gen_status_graph_from_xml [as 别名]
def list_oozie_workflow(request, job_id):
oozie_workflow = check_job_access_permission(request, job_id)
oozie_coordinator = None
if request.GET.get('coordinator_job_id'):
oozie_coordinator = check_job_access_permission(request, request.GET.get('coordinator_job_id'))
oozie_bundle = None
if request.GET.get('bundle_job_id'):
oozie_bundle = check_job_access_permission(request, request.GET.get('bundle_job_id'))
if oozie_coordinator is not None:
setattr(oozie_workflow, 'oozie_coordinator', oozie_coordinator)
if oozie_bundle is not None:
setattr(oozie_workflow, 'oozie_bundle', oozie_bundle)
oozie_parent = oozie_workflow.get_parent_job_id()
if oozie_parent:
oozie_parent = check_job_access_permission(request, oozie_parent)
workflow_data = None
credentials = None
doc = None
hue_workflow = None
workflow_graph = 'MISSING' # default to prevent loading the graph tab for deleted workflows
full_node_list = None
if ENABLE_V2.get():
try:
# To update with the new History document model
hue_coord = get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or get_history().get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord and hue_coord.workflow: hue_coord.workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow: hue_workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow:
workflow_graph = ''
full_node_list = hue_workflow.nodes
workflow_id = hue_workflow.id
wid = {
'id': workflow_id
}
doc = Document2.objects.get(type='oozie-workflow2', **wid)
new_workflow = get_workflow()(document=doc)
workflow_data = new_workflow.get_data()
credentials = Credentials()
else:
# For workflows submitted from CLI or deleted in the editor
# Until better parsing in https://issues.cloudera.org/browse/HUE-2659
workflow_graph, full_node_list = OldWorkflow.gen_status_graph_from_xml(request.user, oozie_workflow)
except:
LOG.exception("Error generating full page for running workflow %s" % job_id)
else:
history = get_history().cross_reference_submission_history(request.user, job_id)
hue_coord = history and history.get_coordinator() or get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or (history and history.get_workflow()) or get_history().get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord and hue_coord.workflow: Job.objects.can_read_or_exception(request, hue_coord.workflow.id)
if hue_workflow: Job.objects.can_read_or_exception(request, hue_workflow.id)
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
full_node_list = hue_workflow.node_list
else:
workflow_graph, full_node_list = get_workflow().gen_status_graph_from_xml(request.user, oozie_workflow)
parameters = oozie_workflow.conf_dict.copy()
for action in oozie_workflow.actions:
action.oozie_coordinator = oozie_coordinator
action.oozie_bundle = oozie_bundle
if request.GET.get('format') == 'json':
return_obj = {
'id': oozie_workflow.id,
'status': oozie_workflow.status,
'progress': oozie_workflow.get_progress(full_node_list),
'graph': workflow_graph,
'actions': massaged_workflow_actions_for_json(oozie_workflow.get_working_actions(), oozie_coordinator, oozie_bundle)
}
return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
oozie_slas = []
if oozie_workflow.has_sla:
oozie_api = get_oozie(request.user, api_version="v2")
params = {
'id': oozie_workflow.id,
'parent_id': oozie_workflow.id
}
oozie_slas = oozie_api.get_oozie_slas(**params)
return render('dashboard/list_oozie_workflow.mako', request, {
'oozie_workflow': oozie_workflow,
'oozie_coordinator': oozie_coordinator,
'oozie_bundle': oozie_bundle,
'oozie_parent': oozie_parent,
'oozie_slas': oozie_slas,
#.........这里部分代码省略.........
示例4: list_oozie_workflow
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import gen_status_graph_from_xml [as 别名]
def list_oozie_workflow(request, job_id):
oozie_workflow = check_job_access_permission(request, job_id)
oozie_coordinator = None
if request.GET.get('coordinator_job_id'):
oozie_coordinator = check_job_access_permission(request, request.GET.get('coordinator_job_id'))
oozie_bundle = None
if request.GET.get('bundle_job_id'):
oozie_bundle = check_job_access_permission(request, request.GET.get('bundle_job_id'))
if oozie_coordinator is not None:
setattr(oozie_workflow, 'oozie_coordinator', oozie_coordinator)
if oozie_bundle is not None:
setattr(oozie_workflow, 'oozie_bundle', oozie_bundle)
if ENABLE_V2.get():
# To update with the new History document model
hue_coord = get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or get_history().get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord and hue_coord.workflow: hue_coord.workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow: hue_workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
full_node_list = hue_workflow.nodes
else:
workflow_graph, full_node_list = '', None
else:
history = get_history().cross_reference_submission_history(request.user, job_id)
hue_coord = history and history.get_coordinator() or get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or (history and history.get_workflow()) or get_history().get_workflow_from_config(oozie_workflow.conf_dict)
if hue_coord and hue_coord.workflow: Job.objects.can_read_or_exception(request, hue_coord.workflow.id)
if hue_workflow: Job.objects.can_read_or_exception(request, hue_workflow.id)
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
full_node_list = hue_workflow.node_list
else:
workflow_graph, full_node_list = Workflow.gen_status_graph_from_xml(request.user, oozie_workflow)
parameters = oozie_workflow.conf_dict.copy()
for action in oozie_workflow.actions:
action.oozie_coordinator = oozie_coordinator
action.oozie_bundle = oozie_bundle
if request.GET.get('format') == 'json':
return_obj = {
'id': oozie_workflow.id,
'status': oozie_workflow.status,
'progress': oozie_workflow.get_progress(full_node_list),
'graph': workflow_graph,
'actions': massaged_workflow_actions_for_json(oozie_workflow.get_working_actions(), oozie_coordinator, oozie_bundle)
}
return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
oozie_slas = []
if oozie_workflow.has_sla:
oozie_api = get_oozie(request.user, api_version="v2")
params = {
'id': oozie_workflow.id,
'parent_id': oozie_workflow.id
}
oozie_slas = oozie_api.get_oozie_slas(**params)
return render('dashboard/list_oozie_workflow.mako', request, {
'oozie_workflow': oozie_workflow,
'oozie_coordinator': oozie_coordinator,
'oozie_bundle': oozie_bundle,
'oozie_slas': oozie_slas,
'hue_workflow': hue_workflow,
'hue_coord': hue_coord,
'parameters': parameters,
'has_job_edition_permission': has_job_edition_permission,
'workflow_graph': workflow_graph
})
示例5: list_oozie_workflow
# 需要导入模块: from oozie.models import Workflow [as 别名]
# 或者: from oozie.models.Workflow import gen_status_graph_from_xml [as 别名]
def list_oozie_workflow(request, job_id):
oozie_workflow = check_job_access_permission(request, job_id)
oozie_coordinator = None
if request.GET.get("coordinator_job_id"):
oozie_coordinator = check_job_access_permission(request, request.GET.get("coordinator_job_id"))
oozie_bundle = None
if request.GET.get("bundle_job_id"):
oozie_bundle = check_job_access_permission(request, request.GET.get("bundle_job_id"))
if oozie_coordinator is not None:
setattr(oozie_workflow, "oozie_coordinator", oozie_coordinator)
if oozie_bundle is not None:
setattr(oozie_workflow, "oozie_bundle", oozie_bundle)
oozie_parent = oozie_workflow.get_parent_job_id()
if oozie_parent:
oozie_parent = check_job_access_permission(request, oozie_parent)
workflow_data = None
credentials = None
doc = None
hue_workflow = None
workflow_graph = "MISSING" # default to prevent loading the graph tab for deleted workflows
full_node_list = None
if ENABLE_V2.get():
try:
# To update with the new History document model
hue_coord = get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
hue_workflow = (hue_coord and hue_coord.workflow) or get_history().get_workflow_from_config(
oozie_workflow.conf_dict
)
if hue_coord and hue_coord.workflow:
hue_coord.workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow:
hue_workflow.document.doc.get().can_read_or_exception(request.user)
if hue_workflow:
workflow_graph = ""
full_node_list = hue_workflow.nodes
workflow_id = hue_workflow.id
wid = {"id": workflow_id}
doc = Document2.objects.get(type="oozie-workflow2", **wid)
new_workflow = get_workflow()(document=doc)
workflow_data = new_workflow.get_data()
credentials = Credentials()
else:
# For workflows submitted from CLI or deleted in the editor
# Until better parsing in https://issues.cloudera.org/browse/HUE-2659
workflow_graph, full_node_list = OldWorkflow.gen_status_graph_from_xml(request.user, oozie_workflow)
except:
LOG.exception("Error generating full page for running workflow %s" % job_id)
else:
history = get_history().cross_reference_submission_history(request.user, job_id)
hue_coord = (
history and history.get_coordinator() or get_history().get_coordinator_from_config(oozie_workflow.conf_dict)
)
hue_workflow = (
(hue_coord and hue_coord.workflow)
or (history and history.get_workflow())
or get_history().get_workflow_from_config(oozie_workflow.conf_dict)
)
if hue_coord and hue_coord.workflow:
Job.objects.can_read_or_exception(request, hue_coord.workflow.id)
if hue_workflow:
Job.objects.can_read_or_exception(request, hue_workflow.id)
if hue_workflow:
workflow_graph = hue_workflow.gen_status_graph(oozie_workflow)
full_node_list = hue_workflow.node_list
else:
workflow_graph, full_node_list = get_workflow().gen_status_graph_from_xml(request.user, oozie_workflow)
parameters = oozie_workflow.conf_dict.copy()
for action in oozie_workflow.actions:
action.oozie_coordinator = oozie_coordinator
action.oozie_bundle = oozie_bundle
if request.GET.get("format") == "json":
return_obj = {
"id": oozie_workflow.id,
"status": oozie_workflow.status,
"progress": oozie_workflow.get_progress(full_node_list),
"graph": workflow_graph,
"actions": massaged_workflow_actions_for_json(
oozie_workflow.get_working_actions(), oozie_coordinator, oozie_bundle
),
}
return JsonResponse(return_obj, encoder=JSONEncoderForHTML)
oozie_slas = []
if oozie_workflow.has_sla:
oozie_api = get_oozie(request.user, api_version="v2")
params = {"id": oozie_workflow.id, "parent_id": oozie_workflow.id}
#.........这里部分代码省略.........