Example #1
0
def run():
    print "Starting OACWellcome Job Processor ... Started"
    initialise()
    error_handler.setup_error_logging(app, "OACWellcome Runner Error", stdout_logging_level=logging.INFO)
    while True:
        time.sleep(app.config.get('OACWELLCOME_JOBS_POLL_TIME', 2))
        try:
            process_jobs()
        except Exception:
            app.logger.error(traceback.format_exc())
        print ".",
        sys.stdout.flush()
Example #2
0
    def test_01_full_synchronous(self):
        # first pretend to do the file upload, using the test submission
        fh = FileHandle(open(TEST_SUBMISSION, "r").read())
        job = workflow.csv_upload(fh, "test_submission.csv", "*****@*****.**")
        time.sleep(2)

        # now call the overall job processor
        workflow.process_jobs()

        # once the job processor is finished, we can export the csv for the job we ran
        csvcontent = workflow.output_csv(job)
        with codecs.open(os.path.join(UPLOAD_DIR, "output.csv"), "wb") as f:
            f.write(csvcontent)
Example #3
0
    def test_02_full_asynchronous(self):
        # first pretend to do the file upload, using the test submission
        fh = FileHandle(open(FULL_SUBMISSION, "r").read())
        job = workflow.csv_upload(fh, "full_submission.csv", "*****@*****.**")
        time.sleep(2)

        # now call the overall job processor
        workflow.process_jobs()

        # once the job processor returns, we must monitor the job itself for completeness
        for i in range(100):
            pc = job.pc_complete
            print i, pc
            if int(pc) == 100:
                break
            time.sleep(2)

        # once the job processor is finished, we can export the csv for the job we ran
        csvcontent = workflow.output_csv(job)
        with codecs.open(os.path.join(UPLOAD_DIR, "output.csv"), "wb", "utf8") as f:
            f.write(csvcontent)