Exemple #1
0
def report_all(job_types, start_time, end_time):
    """Prints the detailed report for given job types"""
    all_records = backend.get_all_records_with_type(job_types,start_time, end_time)
    
    print(tkutil.get_print_header())
    all_records = sorted(all_records, key = lambda x : x["start_time"])
    for details in all_records:
        print(tkutil.get_pretty_print_record(details))
Exemple #2
0
def report_all(job_types, start_time, end_time):
    """Prints the detailed report for given job types"""
    all_records = backend.get_all_records_with_type(job_types, start_time,
                                                    end_time)

    print(tkutil.get_print_header())
    all_records = sorted(all_records, key=lambda x: x["start_time"])
    for details in all_records:
        print(tkutil.get_pretty_print_record(details))
Exemple #3
0
def check_for_overlaps(start_time, end_time):
    """This function checks if any of the previously saved time records overlaps with given time interval.
    In case of overlap, this method will raise an exception
    """
    try:
        with open(completed_jobs_file) as inf:
            for line in inf:
                record_to_check = tkutil.parse_time_details(line)
                if is_overlapping(record_to_check, start_time, end_time):
                    job_details = get_job_details(record_to_check["jobid"])
                    record_to_check["jobname"] = job_details[0]
                    msg = ("The time records is overlapping with the following record, please check:\n%s\n%s"
                                                            % (tkutil.get_print_header(), tkutil.get_pretty_print_record(record_to_check)))
                    raise ValueError(msg)
    except IOError:
        pass # first time so no records at all
Exemple #4
0
def check_for_overlaps(start_time, end_time):
    """This function checks if any of the previously saved time records overlaps with given time interval.
    In case of overlap, this method will raise an exception
    """
    try:
        with open(completed_jobs_file) as inf:
            for line in inf:
                record_to_check = tkutil.parse_time_details(line)
                if is_overlapping(record_to_check, start_time, end_time):
                    job_details = get_job_details(record_to_check["jobid"])
                    record_to_check["jobname"] = job_details[0]
                    msg = (
                        "The time records is overlapping with the following record, please check:\n%s\n%s"
                        % (tkutil.get_print_header(),
                           tkutil.get_pretty_print_record(record_to_check)))
                    raise ValueError(msg)
    except IOError:
        pass  # first time so no records at all