def wait_for_robot(finishedStuff): # # monitor robot job status for all the discs to finish. # totalToWaitFor = len(finishedStuff) reallyFinished = 0 reallyFinishedList = [] ryw.give_news2('waiting for robot...', logging.info) ryw.give_news2('<BR>', logging.info) while True: for job in finishedStuff: tmpImgDir,jrq = job done = ryw_upload.check_robot_finished(jrq) if done and (not job in reallyFinishedList): reallyFinished += 1 reallyFinishedList.append(job) ryw.give_news('robot finished: ' + str(reallyFinished) + ' out of ' + str(totalToWaitFor) + ' disc(s).', logging.info) ryw.give_news(' tmp files: ' + tmpImgDir + ' ' + jrq, logging.info) ryw.give_news(' ', logging.info) if reallyFinished >= totalToWaitFor: break ryw.give_news2('*', logging.info) time.sleep(5) # # wait 60 seconds before removing temp data. # delay = 60 ryw.give_news(' ', logging.info) ryw.give_news('will delete all temporary data in ' + str(delay) + ' seconds. press esc to stop it...', logging.info) ryw.give_news(' ', logging.info) while delay > 0: ryw.give_news2(str(delay) + '...', logging.info) time.sleep(5) delay -= 5 ryw.give_news(' ', logging.info) ryw.give_news('deleting all temporary data...', logging.info) # # remove all temporary data... # for job in reallyFinishedList: tmpImgDir,jrq = job ryw_upload.cleanup_incoming(tmpImgDir, jrq) ryw.give_news('all temporary data removed.', logging.info)
def main(): ryw.check_logging(os.path.join(RepositoryRoot, 'WWW', 'logs'), 'upload.log') logging.debug('ProcessDiscs: entered...') success,tmpdir,jobfile,autorunMerge,overWrite = init_vals() if not success: ryw_upload.quick_exit(1) logging.debug('ProcessDiscs: tmpdir,jobfile: ' + tmpdir + ' ' + jobfile) ryw.give_news('processing incoming disc images located in: ' + tmpdir, logging.info) if autorunMerge: process_autorun_merge_request(tmpdir, overwrite = overWrite) sys.exit(0) process_finished_copies(tmpdir) ryw_upload.cleanup_incoming(tmpdir, jobfile) ryw_view.print_footer() sys.exit(0)
def NOTUSED_main_overlap(): ryw.check_logging(os.path.join(RepositoryRoot, "WWW", "logs"), "upload.log") logging.debug("ReadIncomingCDStack: entered...") success, numDiscs, resources, robotJobsDir, tmpIn = get_init_vals() if not success: sys.exit(1) freeGB = ryw.free_MB(tmpIn) / 1000.0 ryw.give_news("ReadIncomingCDStack: current available disk space: " + repr(freeGB) + " GB.", logging.info) tmpdir, objPrefix = ryw_upload.attempt_just_make_tmpdir(tmpIn, "I_", "") if not tmpdir: ryw.give_bad_news("ReadIncomingCDStack: failed to make tmpdir.", logging.critical) sys.exit(1) jobFile = robot_read_all(robotJobsDir, objPrefix, numDiscs, tmpdir) if not jobFile: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) # monitor the robot's job folder for completion of job # also periodically monitor the tmp folder for completed disk reads while True: ryw.give_news2("*", logging.info) time.sleep(5) logging.debug("ReadIncomingCDStack: done sleeping...") success, done, doneList = check_finished(jobFile, tmpdir) if not success: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) if not done: success, doneList = check_partial_completion(tmpdir) if not success: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) process_finished_copies(tmpdir, doneList) if done: logging.debug("ReadIncomingCDStack: done.") break logging.debug("ReadIncomingCDStack: removing robot job data: " + tmpdir + " " + jobFile) ryw_upload.cleanup_incoming(tmpdir, jobFile)
def main_nonoverlap(): ryw.check_logging(os.path.join(RepositoryRoot, "WWW", "logs"), "upload.log") logging.debug("ReadIncomingCDStack: entered...") success, numDiscs, resources, robotJobsDir, tmpIn = get_init_vals() if not success: sys.exit(1) freeGB = ryw.free_MB(tmpIn) / 1000.0 ryw.give_news("current available disk space: " + repr(freeGB) + " GB.", logging.info) tmpdir, objPrefix = ryw_upload.attempt_just_make_tmpdir(tmpIn, "I_", "") if not tmpdir: ryw.give_bad_news("ReadIncomingCDStack: failed to make tmpdir.", logging.critical) sys.exit(1) ryw.give_news("begin copying incoming discs...", logging.info) jobFile = robot_read_all(robotJobsDir, objPrefix, numDiscs, tmpdir) if not jobFile: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) # monitor the robot's job folder for completion of job. ryw.give_news("", logging.info) oldDone = [] while True: ryw.give_news2("*", logging.info) time.sleep(5) logging.debug("ReadIncomingCDStack: done sleeping...") success, done, doneList = check_finished(jobFile, tmpdir) if not success: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) if not done: success, doneList = check_partial_completion(tmpdir) if not success: ryw_upload.cleanup_incoming(tmpdir, jobFile) sys.exit(1) # process_finished_copies(tmpdir, doneList) print_done_discs(doneList, oldDone) oldDone = doneList if done: logging.debug("ReadIncomingCDStack: done.") break print_conclusion(doneList, tmpdir, jobFile)