Ejemplo n.º 1
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)
Ejemplo n.º 2
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)