Exemple #1
0
def gantt_chart(root_wf_id, wf_id):
    '''
    Get information required to generate a Gantt chart.
    '''
    dashboard = Dashboard(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)
Exemple #2
0
def workflow(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(root_wf_id, wf_id=wf_id)
    else:
        dashboard = Dashboard(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)
Exemple #3
0
def successful_invocations(root_wf_id, wf_id, job_id):
    '''
    Get list of successful invocations for a given job.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    successful_invocations_list = dashboard.get_successful_job_invocation(
        wf_id, job_id)

    for item in successful_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(successful_invocations_list) > 0:
            return render_template(
                'workflow/job/invocations_successful.xhr.html',
                root_wf_id=root_wf_id,
                wf_id=wf_id,
                job_id=job_id,
                invocations=successful_invocations_list)
        else:
            return '', 204
    else:
        return render_template('workflow/job/invocations_successful.html',
                               root_wf_id=root_wf_id,
                               wf_id=wf_id,
                               job_id=job_id,
                               invocations=successful_invocations_list)
Exemple #4
0
def job(root_wf_id, wf_id, job_id):
    '''
    Get details of a specific job instance.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    job = dashboard.get_job_information(wf_id, job_id)
    job_states = dashboard.get_job_states(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_states=job_states)
Exemple #5
0
def job(root_wf_id, wf_id, job_id):
    '''
    Get details of a specific job instance.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    job = dashboard.get_job_information(wf_id, job_id)
    job_states = dashboard.get_job_states(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_states=job_states)
Exemple #6
0
def failed_jobs(root_wf_id, wf_id):
    '''
    Get a list of all failed jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    args = __get_datatables_args()

    total_count, filtered_count, failed_jobs_list = dashboard.get_failed_jobs(
        wf_id, **args)

    for job in failed_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.exec_job_id + '</a>'
        job.stdout = '<a href="' + url_for(
            'stdout', root_wf_id=root_wf_id, wf_id=wf_id,
            job_id=job.job_id) + '">stdout</a>'
        job.stderr = '<a href="' + url_for(
            'stderr', root_wf_id=root_wf_id, wf_id=wf_id,
            job_id=job.job_id) + '">stderr</a>'

    return render_template('workflow/jobs_failed.xhr.json',
                           count=total_count,
                           filtered=filtered_count,
                           jobs=failed_jobs_list,
                           table_args=args)
Exemple #7
0
def workflow_summary_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    summary_times = dashboard.workflow_summary_stats(wf_id)

    for key, value in summary_times.items():
        summary_times[key] = filters.time_to_str(value)

    return json.dumps(summary_times)
Exemple #8
0
def time_chart(root_wf_id, wf_id):
    '''
    Get job-distribution information
    '''
    dashboard = Dashboard(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)
Exemple #9
0
def invocation(root_wf_id, wf_id, job_id, task_id=None):
    '''
    Get detailed invocation information
    '''
    dashboard = Dashboard(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)
Exemple #10
0
def workflow_summary_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    summary_times = dashboard.workflow_summary_stats(wf_id)

    for key, value in summary_times.items():
        summary_times[key] = filters.time_to_str(value)

    return json.dumps(summary_times)
Exemple #11
0
def charts(root_wf_id, wf_id):
    '''
    Get job-distribution information
    '''
    dashboard = Dashboard(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)
Exemple #12
0
def gantt_chart(root_wf_id, wf_id):
    '''
    Get information required to generate a Gantt chart.
    '''
    dashboard = Dashboard(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)
Exemple #13
0
def charts(root_wf_id, wf_id):
    '''
    Get job-distribution information
    '''
    dashboard = Dashboard(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)
Exemple #14
0
def stderr(root_wf_id, wf_id, job_id):
    '''
    Get stderr contents for a specific job instance.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    text = dashboard.get_stderr(wf_id, job_id)

    if text.stderr_text == None:
        return 'No Standard error for workflow ' + wf_id + ' job-id ' + job_id
    else:
        pattern = re.compile('%0a', re.IGNORECASE)
        return '<pre>%s</pre>' % pattern.sub('\n', text.stderr_text)
Exemple #15
0
def time_chart(root_wf_id, wf_id):
    '''
    Get job-distribution information
    '''
    dashboard = Dashboard(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)
Exemple #16
0
def stderr(root_wf_id, wf_id, job_id):
    '''
    Get stderr contents for a specific job instance.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    text = dashboard.get_stderr(wf_id, job_id)

    if text.stderr_text == None:
        return 'No Standard error for workflow ' + wf_id + ' job-id ' + job_id;
    else:
        pattern = re.compile('%0a', re.IGNORECASE)
        return '<pre>%s</pre>' % pattern.sub('\n', text.stderr_text)
Exemple #17
0
def running_jobs(root_wf_id, wf_id):
    '''
    Get a list of all running jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(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.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)
Exemple #18
0
def statistics(root_wf_id, wf_id):
    '''
    Get workflow statistics information
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    summary_times = dashboard.workflow_summary_stats(wf_id)

    for key, value in summary_times.items():
        summary_times[key] = filters.time_to_str(value)

    workflow_stats = dashboard.workflow_stats()

    return render_template('workflow/statistics.html', root_wf_id=root_wf_id, wf_id=wf_id, summary_stats=summary_times, workflow_stats=workflow_stats)
Exemple #19
0
def invocation(root_wf_id, wf_id, job_id, task_id=None):
    '''
    Get detailed invocation information
    '''
    dashboard = Dashboard(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)
Exemple #20
0
def successful_jobs(root_wf_id, wf_id):
    '''
    Get a list of all successful jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(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.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)
Exemple #21
0
def failed_jobs(root_wf_id, wf_id):
    '''
    Get a list of all failed jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    args = __get_datatables_args()

    total_count, filtered_count, failed_jobs_list = dashboard.get_failed_jobs(wf_id, **args)

    for job in failed_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.exec_job_id + '</a>'
        job.stdout = '<a href="' + url_for('stdout', root_wf_id=root_wf_id, wf_id=wf_id, job_id=job.job_id) + '">stdout</a>'
        job.stderr = '<a href="' + url_for('stderr', root_wf_id=root_wf_id, wf_id=wf_id, job_id=job.job_id) + '">stderr</a>'

    return render_template('workflow/jobs_failed.xhr.json', count=total_count, filtered=filtered_count, jobs=failed_jobs_list, table_args=args)
Exemple #22
0
def failed_invocations(root_wf_id, wf_id, job_id):
    '''
    Get list of failed invocations for a given job.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    failed_invocations_list = dashboard.get_failed_job_invocation(wf_id, job_id)

    # 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, 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, invocations=failed_invocations_list)
Exemple #23
0
def sub_workflows(root_wf_id, wf_id):
    '''
    Get a list of all sub-workflow of a given workflow.
    '''
    dashboard = Dashboard(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)
Exemple #24
0
def index():
    '''
    List all workflows from the master database.
    '''
    try:
        dashboard = Dashboard()
        args = __get_datatables_args()
        count, filtered, workflows, totals = dashboard.get_root_workflow_list(**args)
        __update_label_link(workflows)
        __update_timestamp(workflows)
    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', workflows=[], counts=(0, 0, 0, 0))
Exemple #25
0
def statistics(root_wf_id, wf_id):
    '''
    Get workflow statistics information
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    summary_times = dashboard.workflow_summary_stats(wf_id)

    for key, value in summary_times.items():
        summary_times[key] = filters.time_to_str(value)

    workflow_stats = dashboard.workflow_stats()

    return render_template('workflow/statistics.html',
                           root_wf_id=root_wf_id,
                           wf_id=wf_id,
                           summary_stats=summary_times,
                           workflow_stats=workflow_stats)
Exemple #26
0
def successful_invocations(root_wf_id, wf_id, job_id):
    '''
    Get list of successful invocations for a given job.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    successful_invocations_list = dashboard.get_successful_job_invocation(wf_id, job_id)

    for item in successful_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(successful_invocations_list) > 0:
            return render_template('workflow/job/invocations_successful.xhr.html', root_wf_id=root_wf_id, wf_id=wf_id, job_id=job_id, invocations=successful_invocations_list)
        else:
            return '', 204
    else:
        return render_template('workflow/job/invocations_successful.html', root_wf_id=root_wf_id, wf_id=wf_id, job_id=job_id, invocations=successful_invocations_list)
Exemple #27
0
def workflow(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(root_wf_id, wf_id=wf_id)
    else:
        dashboard = Dashboard(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);
Exemple #28
0
def running_jobs(root_wf_id, wf_id):
    '''
    Get a list of all running jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(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.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)
Exemple #29
0
def sub_workflows(root_wf_id, wf_id):
    '''
    Get a list of all sub-workflow of a given workflow.
    '''
    dashboard = Dashboard(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)
Exemple #30
0
def successful_jobs(root_wf_id, wf_id):
    '''
    Get a list of all successful jobs of the latest instance for a given workflow.
    '''
    dashboard = Dashboard(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.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)
Exemple #31
0
def index():
    '''
    List all workflows from the master database.
    '''
    try:
        dashboard = Dashboard()
        args = __get_datatables_args()
        count, filtered, workflows, totals = dashboard.get_root_workflow_list(
            **args)
        __update_label_link(workflows)
        __update_timestamp(workflows)
    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',
                               workflows=[],
                               counts=(0, 0, 0, 0))
Exemple #32
0
def failed_invocations(root_wf_id, wf_id, job_id):
    '''
    Get list of failed invocations for a given job.
    '''
    dashboard = Dashboard(root_wf_id, wf_id)
    failed_invocations_list = dashboard.get_failed_job_invocation(
        wf_id, job_id)

    # 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,
                                   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,
                               invocations=failed_invocations_list)
Exemple #33
0
def job_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    return json.dumps(dashboard.job_stats())
Exemple #34
0
def workflow_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    return json.dumps(dashboard.workflow_stats())
Exemple #35
0
def workflow_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    return json.dumps(dashboard.workflow_stats())
Exemple #36
0
def job_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)
    return json.dumps(dashboard.job_stats())
Exemple #37
0
def time_stats(root_wf_id, wf_id):
    dashboard = Dashboard(root_wf_id, wf_id)

    return '{}'