Пример #1
0
def get_current_job_remaining():
    # Returns the time left to complete current job
    db = Database()

    job = db.get_current_job()
    current_time = datetime.datetime.utcnow()
    start_time = job.start_time
    length = job.length

    running_time = int((current_time - start_time).seconds)
    time_left = length - running_time

    Logging().info(
        f"Current job status: running_time: {running_time}, time_left: {time_left}"
    )

    if time_left <= 0:
        # Time left is less than 0, probably uploading or doing something
        return 0
    else:
        return time_left
Пример #2
0
def get_current_job_id():
    db = Database()
    job = db.get_current_job()
    logging.info(f"Current job ID is: {job.challenge_id}")
    return (job.challenge_id)