本文整理汇总了Python中Pegasus.service.dashboard.dashboard.Dashboard类的典型用法代码示例。如果您正苦于以下问题:Python Dashboard类的具体用法?Python Dashboard怎么用?Python Dashboard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dashboard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gantt_chart
def gantt_chart(username, root_wf_id, wf_id):
"""
Get information required to generate a Gantt chart.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
gantt_chart = dashboard.plots_gantt_chart()
return render_template('workflow/charts/gantt_chart.json', root_wf_id=root_wf_id, wf_id=wf_id, gantt_chart=gantt_chart)
示例2: workflow
def workflow(username, root_wf_id, wf_id=None):
"""
Get details for a specific workflow.
"""
wf_uuid = request.args.get("wf_uuid", None)
if not wf_id and not wf_uuid:
raise ValueError, "Workflow ID or Workflow UUID is required"
if wf_id:
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id=wf_id)
else:
dashboard = Dashboard(g.master_db_url, root_wf_id)
try:
counts, details, statistics = dashboard.get_workflow_information(wf_id, wf_uuid)
except NoResultFound:
return render_template("error/workflow/workflow_details_missing.html")
return render_template(
"workflow/workflow_details.html",
root_wf_id=root_wf_id,
wf_id=details.wf_id,
workflow=details,
counts=counts,
statistics=statistics,
)
示例3: failed_invocations
def failed_invocations(username, root_wf_id, wf_id, job_id, job_instance_id):
"""
Get list of failed invocations for a given job.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
failed_invocations_list = dashboard.get_failed_job_invocation(wf_id, job_id, job_instance_id)
for item in failed_invocations_list:
item.remote_duration_formatted = filters.time_to_str(item.remote_duration)
# is_xhr = True if it is AJAX request.
if request.is_xhr:
if len(failed_invocations_list) > 0:
return render_template(
"workflow/job/invocations_failed.xhr.html",
root_wf_id=root_wf_id,
wf_id=wf_id,
job_id=job_id,
job_instance_id=job_instance_id,
invocations=failed_invocations_list,
)
else:
return "", 204
else:
return render_template(
"workflow/job/invocations_failed.html",
root_wf_id=root_wf_id,
wf_id=wf_id,
job_id=job_id,
job_instance_id=job_instance_id,
invocations=failed_invocations_list,
)
示例4: successful_jobs
def successful_jobs(username, root_wf_id, wf_id):
"""
Get a list of all successful jobs of the latest instance for a given workflow.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
args = __get_datatables_args()
total_count, filtered_count, successful_jobs_list = dashboard.get_successful_jobs(wf_id, **args)
for job in successful_jobs_list:
job.duration_formatted = filters.time_to_str(job.duration)
job.exec_job_id = (
'<a href="'
+ url_for(
".job", root_wf_id=root_wf_id, wf_id=wf_id, job_id=job.job_id, job_instance_id=job.job_instance_id
)
+ '">'
+ job.exec_job_id
+ "</a>"
)
return render_template(
"workflow/jobs_successful.xhr.json",
count=total_count,
filtered=filtered_count,
jobs=successful_jobs_list,
table_args=args,
)
示例5: file_list
def file_list(username, root_wf_id, wf_id):
try:
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id=wf_id)
details = dashboard.get_workflow_details(wf_id)
submit_dir = details.submit_dir
if os.path.isdir(submit_dir):
folders = {}
for folder, sub_folders, files in os.walk(submit_dir):
folder = '/' + folder.replace(submit_dir, '', 1).lstrip('/')
folders[folder] = {'D': [], 'F': files}
for sub_folder in sub_folders:
full_sub_folder = os.path.normpath(os.path.join(folder, sub_folder))
folders[folder]['D'].append(full_sub_folder)
return json.dumps(folders), 200, {'Content-Type': 'application/json'}
else:
raise ServiceError(ErrorResponse('SUBMIT_DIR_NOT_FOUND', '%r is not a valid directory' % str(submit_dir)))
except NoResultFound:
return render_template('error/workflow/workflow_details_missing.html')
return 'Error', 500
示例6: file_browser
def file_browser(username, root_wf_id, wf_id):
try:
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id=wf_id)
details = dashboard.get_workflow_details(wf_id)
submit_dir = details.submit_dir
if os.path.isdir(submit_dir):
init_file = request.args.get('init_file', None)
return render_template(
'file-browser.html',
root_wf_id=root_wf_id,
wf_id=wf_id,
init_file=init_file
)
else:
raise ServiceError(
ErrorResponse(
'SUBMIT_DIR_NOT_FOUND',
'%r is not a valid directory' % str(submit_dir)
)
)
except NoResultFound:
return render_template('error/workflow/workflow_details_missing.html')
return 'Error', 500
示例7: running_jobs
def running_jobs(username, root_wf_id, wf_id):
"""
Get a list of all running jobs of the latest instance for a given workflow.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
args = __get_datatables_args()
total_count, filtered_count, running_jobs_list = dashboard.get_running_jobs(wf_id, **args)
for job in running_jobs_list:
job.exec_job_id = (
'<a href="'
+ url_for(
".job", root_wf_id=root_wf_id, wf_id=wf_id, job_id=job.job_id, job_instance_id=job.job_instance_id
)
+ '">'
+ job.exec_job_id
+ "</a>"
)
return render_template(
"workflow/jobs_running.xhr.json",
count=total_count,
filtered=filtered_count,
jobs=running_jobs_list,
table_args=args,
)
示例8: job
def job(username, root_wf_id, wf_id, job_id, job_instance_id):
"""
Get details of a specific job instance.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
job = dashboard.get_job_information(wf_id, job_id, job_instance_id)
job_states = dashboard.get_job_states(wf_id, job_id, job_instance_id)
job_instances = dashboard.get_job_instances(wf_id, job_id)
previous = None
for state in job_states:
timestamp = state.timestamp
state.timestamp = datetime.fromtimestamp(state.timestamp).strftime("%a %b %d, %Y %I:%M:%S %p")
if previous is None:
state.interval = 0.0
else:
state.interval = timestamp - previous
previous = timestamp
if not job:
return "Bad Request", 400
return render_template(
"workflow/job/job_details.html",
root_wf_id=root_wf_id,
wf_id=wf_id,
job_id=job_id,
job=job,
job_instances=job_instances,
job_states=job_states,
)
示例9: file_list
def file_list(username, root_wf_id, wf_id, path=""):
try:
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id=wf_id)
details = dashboard.get_workflow_details(wf_id)
submit_dir = details.submit_dir
if os.path.isdir(submit_dir):
dest = os.path.join(submit_dir, path)
if os.path.isfile(dest):
return "", 204
folders = {"dirs": [], "files": []}
for entry in os.listdir(dest):
if os.path.isdir(os.path.join(dest, entry)):
folders["dirs"].append(os.path.normpath(os.path.join(path, entry)))
else:
folders["files"].append(os.path.normpath(os.path.join(path, entry)))
return json.dumps(folders), 200, {"Content-Type": "application/json"}
else:
raise ServiceError(ErrorResponse("SUBMIT_DIR_NOT_FOUND", "%r is not a valid directory" % str(submit_dir)))
except NoResultFound:
return render_template("error/workflow/workflow_details_missing.html")
return "Error", 500
示例10: sub_workflows
def sub_workflows(username, root_wf_id, wf_id):
"""
Get a list of all sub-workflow of a given workflow.
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
sub_workflows = dashboard.get_sub_workflows(wf_id)
# is_xhr = True if it is AJAX request.
if request.is_xhr:
if len(sub_workflows) > 0:
return render_template(
'workflow/sub_workflows.xhr.html',
root_wf_id=root_wf_id,
wf_id=wf_id,
workflows=sub_workflows
)
else:
return '', 204
else:
return render_template(
'workflow/sub_workflows.html',
root_wf_id=root_wf_id,
wf_id=wf_id,
workflows=sub_workflows
)
示例11: index
def index(username):
"""
List all workflows from the master database.
"""
try:
dashboard = Dashboard(g.master_db_url)
args = __get_datatables_args()
if request.is_xhr:
count, filtered, workflows, totals = dashboard.get_root_workflow_list(**args)
__update_label_link(workflows)
__update_timestamp(workflows)
for workflow in workflows:
workflow.state = (
(workflow.state + " (%s)" % workflow.reason)
if workflow.status > 0 and workflow.reason
else workflow.state
)
else:
totals = dashboard.get_root_workflow_list(counts_only=True, **args)
except NoWorkflowsFoundError, e:
if request.is_xhr:
return render_template(
"workflow.xhr.json", count=e.count, filtered=e.filtered, workflows=[], table_args=args
)
return render_template("workflow.html", counts=(0, 0, 0, 0))
示例12: time_chart
def time_chart(username, root_wf_id, wf_id):
"""
Get job-distribution information
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
time_chart_job, time_chart_invocation = dashboard.plots_time_chart(wf_id)
return render_template('workflow/charts/time_chart.json', root_wf_id=root_wf_id, wf_id=wf_id, time_chart_job=time_chart_job, time_chart_invocation=time_chart_invocation)
示例13: charts
def charts(username, root_wf_id, wf_id):
"""
Get job-distribution information
"""
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
job_dist = dashboard.plots_transformation_statistics(wf_id)
return render_template("workflow/charts.html", root_wf_id=root_wf_id, wf_id=wf_id, job_dist=job_dist)
示例14: charts
def charts(root_wf_id, wf_id):
'''
Get job-distribution information
'''
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
job_dist = dashboard.plots_transformation_statistics(wf_id)
return render_template('workflow/charts.html', root_wf_id=root_wf_id, wf_id=wf_id, job_dist=job_dist)
示例15: invocation
def invocation(root_wf_id, wf_id, job_id, task_id=None):
'''
Get detailed invocation information
'''
dashboard = Dashboard(g.master_db_url, root_wf_id, wf_id)
invocation = dashboard.get_invocation_information(wf_id, job_id, task_id)
return render_template('workflow/job/invocation/invocation_details.html', root_wf_id=root_wf_id, wf_id=wf_id, job_id=job_id, task_id=task_id, invocation=invocation)