Beispiel #1
0
    def test_04_process_oag(self):
        job = models.SpreadsheetJob()
        job.save()

        oag_register = [{
            "id": "PMC1234",
            "type": "pmcid"
        }, {
            "id": "10.1234",
            "type": "doi"
        }, {
            "id": "10.5678",
            "type": "doi"
        }, {
            "id": "abcd",
            "type": "pmid"
        }]

        workflow.process_oag(oag_register, job)

        time.sleep(2)

        link = models.OAGRLink.by_spreadsheet_id(job.id)
        assert link is not None
        assert link.spreadsheet_id == job.id
        assert link.oagrjob_id is not None

        oj = oagr.dao.JobsDAO.pull(link.oagrjob_id)
        assert oj is not None
        state = oj.state()
        assert len(state.pending) == 4
    def test_04_process_oag(self):
        job = models.SpreadsheetJob()
        job.save()

        oag_register = [
            {"id" : "PMC1234", "type" : "pmcid"},
            {"id" : "10.1234", "type" : "doi"},
            {"id" : "10.5678", "type" : "doi"},
            {"id" : "abcd", "type" : "pmid"}
        ]

        workflow.process_oag(oag_register, job)

        time.sleep(2)

        link = models.OAGRLink.by_spreadsheet_id(job.id)
        assert link is not None
        assert link.spreadsheet_id == job.id
        assert link.oagrjob_id is not None

        oj = oagr.dao.JobsDAO.pull(link.oagrjob_id)
        assert oj is not None
        state = oj.state()
        assert len(state.pending) == 4
Beispiel #3
0
    record.upload_pos = 1

    if args.type.lower() == "pmcid":
        record.pmcid = args.identifier
    elif args.type.lower() == "pmid":
        record.pmid = args.identifier
    elif args.type.lower() == "doi":
        record.doi = args.identifier
    record.save()

    time.sleep(2)

    oag_register = []
    msg = workflow.WorkflowMessage(job, record, oag_register)
    workflow.process_record(msg)
    workflow.process_oag(oag_register, job)

    time.sleep(2)

    i = 0
    while True:
        i += 1
        pcc = job.pc_complete
        print i, job.pc_complete, "%",
        sys.stdout.flush()
        if int(pcc) == 100:
            break
        time.sleep(2)

    out = workflow.output_csv(job)
    print out
Beispiel #4
0
    record.upload_pos = 1

    if args.type.lower() == "pmcid":
        record.pmcid = args.identifier
    elif args.type.lower() == "pmid":
        record.pmid = args.identifier
    elif args.type.lower() == "doi":
        record.doi = args.identifier
    record.save()

    time.sleep(2)

    oag_register = []
    msg = workflow.WorkflowMessage(job, record, oag_register)
    workflow.process_record(msg)
    workflow.process_oag(oag_register, job)

    time.sleep(2)

    i = 0
    while True:
        i += 1
        pcc = job.pc_complete
        print i, job.pc_complete, "%",
        sys.stdout.flush()
        if int(pcc) == 100:
            break
        time.sleep(2)

    out = workflow.output_csv(job)
    print out