示例#1
0
def run_job_and_wait_for_completion(job, swf=None):
    if (swf is not None):
        run = client.JobAPI(session).run(job['id'], swf['id'])
    else:
        run = client.JobAPI(session).run(job['id'])
    logger.info("Running job... please wait.")
    time.sleep(5)
    job = update_job(job['id'])
    while (job['lastrun']['status'] == "RUNNING"):
        time.sleep(5)
        job = update_job(job['id'])
    logger.info("Job finished.")
示例#2
0
def run_restore_job(job):
    if (options.cancel.upper() == "TRUE"):
        jobsession = get_pending_job_session(job)
        logger.info("Cleaning up job %s" % job['name'])
        sessioninfo = jobsession['id'] + "?action=resume&actionname=end_iv"
        return client.EcxAPI(session, 'jobsession').post(path=sessioninfo)
    logger.info("Running job %s" % job['name'])
    if (options.mode.upper() == "TEST"):
        run = client.JobAPI(session).run(job['id'], "start_test_iv")
    elif (options.mode.upper() == "PRODUCTION"):
        run = client.JobAPI(session).run(job['id'], "start_recovery_iv")
    elif (options.mode.upper() == "CLONE"):
        run = client.JobAPI(session).run(job['id'], "start_clone_iv")
    return run
def run_job_and_wait_for_completion(job, swf=None):
    matchfound = False
    if (swf is not None):
        run = client.JobAPI(session).run(job['id'], swf['id'])
    else:
        run = client.JobAPI(session).run(job['id'])
    logger.info("Running job... please wait.")
    time.sleep(1)
    job = update_job(job['id'])
    while (job['lastrun']['status'] == "RUNNING"):
        time.sleep(5)
        job = update_job(job['id'])
        if (options.regex is not None and matchfound is not True):
            matchfound = match_regex_in_logs(job)
    logger.info("Job finished.")
def match_regex_in_logs(job):
    logs = client.JobAPI(session).get_log_entries(job['lastrun']['sessionId'])
    p = re.compile(options.regex)
    for line in logs:
        m = p.match(line['message'])
        if m:
            print m.group()
            return True
示例#5
0
def run_backup_job_and_wait_for_finish(backupjob):
    run = client.JobAPI(session).run(backupjob['id'])
    logger.info("Running backup job, please wait.")
    time.sleep(5)
    job = client.EcxAPI(session, 'job').get(resid=backupjob['id'])
    while (job['lastrun']['status'] == "RUNNING"):
        time.sleep(5)
        job = client.EcxAPI(session, 'job').get(resid=backupjob['id'])
    return job
示例#6
0
def run_restore_job(job):
    if (options.cancel.upper() == "TRUE"):
        jobsession = get_pending_job_session(job)
        logger.info("Cleaning up job %s" % job['name'])
        sessioninfo = jobsession['id'] + "?action=resume&actionname=end_iv"
        return client.EcxAPI(session, 'jobsession').post(path=sessioninfo)
    if (options.run.upper() == "TRUE"):
        logger.info("Running job %s" % job['name'])
        return client.JobAPI(session).run(job['id'], "start_test_iv")
def run_backup_job_and_wait_for_completion(bujob):
    logger.info("Running backup job... please wait.")
    run = client.JobAPI(session).run(bujob['id'])
    time.sleep(10)
    job = client.EcxAPI(session, 'job').get(resid=bujob['id'])
    while (job['lastrun']['status'] == "RUNNING"):
        time.sleep(10)
        job = client.EcxAPI(session, 'job').get(resid=bujob['id'])
    if (job['lastrun']['status'] == "COMPLETED"):
        return job
    logger.error("Job did not complete, please log in to UI to view logs.")
    session.delete('endeavour/session/')
    sys.exit(2)
def run_restore_job_and_wait_for_completion(resjob):
    logger.info("Running restore job... please wait.")
    run = client.JobAPI(session).run(resjob['id'])
    time.sleep(10)
    job = client.EcxAPI(session, 'job').get(resid=resjob['id'])
    # Note: We need to also wait here on RESOURCE ACTIVE state as job goes into that
    # status during the "Make Permanent" operation
    # However, if this step fails, we are then stuck in that state until restore is cancelled
    # may want to introduce some sort of timeout failure here
    while (job['lastrun']['status'] == "RUNNING"
           or job['lastrun']['status'] == "RESOURCE ACTIVE"):
        time.sleep(10)
        job = client.EcxAPI(session, 'job').get(resid=resjob['id'])
    if (job['lastrun']['status'] == "COMPLETED"):
        return job
    logger.error("Job did not complete, please log in to UI to view logs.")
    session.delete('endeavour/session/')
    sys.exit(2)
示例#9
0
def run_backup_job(job, swfid=None):
    run = client.JobAPI(session).run(job['id'], swfid)
    return run
def output_logs(job):
    return client.JobAPI(session).get_log_entries(job['lastrun']['sessionId'])
示例#11
0
def run_generated_job(job):
    return client.JobAPI(session).run(job['id'])
def run_maint_job():
    logger.info("Running maintenance job.")
    jobs = client.EcxAPI(session, 'job').list()
    for job in jobs:
        if (job['type'] == "maintenance"):
            client.JobAPI(session).run(job['id'])
示例#13
0
def run_restore_job(restorejob):
    client.JobAPI(session).run(restorejob['id'])
示例#14
0
def run_restore_job(job):
    logger.info("Running restore job: %s" % job['name'])
    job = client.JobAPI(session).run(job['id'])
    return job