示例#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))
示例#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))
示例#3
0
def delete_record(record_id):
    """Parses deleterecord arguments and fires the delete time record action"""
    try:
        record = backend.delete_from_records(record_id)
        print("Following record has been deleted:")
        print(tkutil.get_pretty_print_record(record))
    except ValueError as msg:
        print(msg)
        return
    except IOError:
        print("An error occured, please try again")
示例#4
0
def delete_record(record_id):
    """Parses deleterecord arguments and fires the delete time record action"""
    try:
        record = backend.delete_from_records(record_id)
        print("Following record has been deleted:")
        print(tkutil.get_pretty_print_record(record))
    except ValueError as msg:
        print(msg)
        return
    except IOError:
        print("An error occured, please try again")
示例#5
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
示例#6
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