Пример #1
0
def runPhase(phase, rcq = None):

    # if this task is run by a remote client return
    # task id for monitoring
    if rcq is not None:
        runPhase.rabbitHelper.putMsg(rcq, runPhase.request.id)

    ddocs = workload = workloadIds = cluster = query = queryIds =\
        buckets = xdcr = teardown = ssh = None
    docTemplate = "default"
    rebalance_required = False

    name = "<phase name>"
    desc = "<phase description>"

    # default time a workload is run without any conditions in seconds
    runTime = 10

    if 'name' in phase:
        name = phase['name']
    if 'desc' in phase:
        desc = phase['desc']
    if 'cluster' in phase:
        cluster = phase['cluster']
    if 'workload' in phase:
        workload = phase['workload']
    if 'query' in phase:
        query = phase['query']
    if 'runtime' in phase:
        runTime = int(phase['runtime'])
    if 'buckets' in phase:
        buckets = phase['buckets']
    if 'ddocs' in phase:
        ddocs = phase['ddocs']
    if 'xdcr' in phase:
        xdcr = phase['xdcr']
    if 'teardown' in phase:
        teardown = phase['teardown']
    if 'ssh' in phase:
        ssh = phase['ssh']

    logger.error('\n')
    logger.error("Running Phase: %s (%s)" % (name, desc))

    if buckets is not None:
        perform_bucket_create_tasks(buckets)

    if ddocs is not None:
        perform_view_tasks(ddocs)

    if xdcr is not None:
        perform_xdcr_tasks(xdcr)

    if ssh is not None:
        perform_cli_task(ssh)

    if cluster is not None:
        if isinstance(cluster, list):
            cluster = cluster[0] # there can only be one cluster task-per-site

        clusterMsg = parseClusterReq(cluster)
	logger.error("{0}".format(clusterMsg))
        perform_admin_tasks(clusterMsg)
        rebalance_required = clusterMsg['rebalance_required']

    if workload is not None:
        workloadIds = activateWorkloads(workload)

    if query is not None:
        queryIds = activateQueries(query)

    if teardown is not None:
        perform_teardown_tasks(teardown)

    # monitor phase
    phase_status = monitorPhase(runTime, workloadIds, rebalance_required, queryIds)

    # phase complete: #TODO stat report
    time.sleep(5)

    return phase_status
Пример #2
0
def runPhase(phase, rcq=None):

    # if this task is run by a remote client return
    # task id for monitoring
    if rcq is not None:
        runPhase.rabbitHelper.putMsg(rcq, runPhase.request.id)

    ddocs = workload = workloadIds = cluster = query = queryIds = buckets = xdcr = teardown = ssh = None
    docTemplate = "default"
    rebalance_required = False

    name = "<phase name>"
    desc = "<phase description>"

    # default time a workload is run without any conditions in seconds
    runTime = 10

    if "name" in phase:
        name = phase["name"]
    if "desc" in phase:
        desc = phase["desc"]
    if "cluster" in phase:
        cluster = phase["cluster"]
    if "workload" in phase:
        workload = phase["workload"]
    if "query" in phase:
        query = phase["query"]
    if "runtime" in phase:
        runTime = int(phase["runtime"])
    if "buckets" in phase:
        buckets = phase["buckets"]
    if "ddocs" in phase:
        ddocs = phase["ddocs"]
    if "xdcr" in phase:
        xdcr = phase["xdcr"]
    if "teardown" in phase:
        teardown = phase["teardown"]
    if "ssh" in phase:
        ssh = phase["ssh"]

    logger.error("\n")
    logger.error("Running Phase: %s (%s)" % (name, desc))

    if buckets is not None:
        perform_bucket_create_tasks(buckets)

    if ddocs is not None:
        perform_view_tasks(ddocs)

    if xdcr is not None:
        perform_xdcr_tasks(xdcr)

    if ssh is not None:
        perform_cli_task(ssh)

    if cluster is not None:
        if isinstance(cluster, list):
            cluster = cluster[0]  # there can only be one cluster task-per-site

        clusterMsg = parseClusterReq(cluster)
        perform_admin_tasks(clusterMsg)
        rebalance_required = clusterMsg["rebalance_required"]

    if workload is not None:
        workloadIds = activateWorkloads(workload)

    if query is not None:
        queryIds = activateQueries(query)

    if teardown is not None:
        perform_teardown_tasks(teardown)

    # monitor phase
    phase_status = monitorPhase(runTime, workloadIds, rebalance_required, queryIds)

    # phase complete: #TODO stat report
    time.sleep(5)

    return phase_status
Пример #3
0
def runPhase(phase, rcq=None):

    # if this task is run by a remote client return
    # task id for monitoring
    if rcq is not None:
        runPhase.rabbitHelper.putMsg(rcq, runPhase.request.id)

    ddocs = workload = workloadIds = cluster = query = queryIds =\
        buckets = xdcr = teardown = None
    docTemplate = "default"
    rebalance_required = False

    name = "<phase name>"
    desc = "<phase description>"

    # default time a workload is run without any conditions in seconds
    runTime = 10

    if 'name' in phase:
        name = phase['name']
    if 'desc' in phase:
        desc = phase['desc']
    if 'cluster' in phase:
        cluster = phase['cluster']
    if 'workload' in phase:
        workload = phase['workload']
    if 'query' in phase:
        query = phase['query']
    if 'runtime' in phase:
        runTime = int(phase['runtime'])
    if 'buckets' in phase:
        buckets = phase['buckets']
    if 'ddocs' in phase:
        ddocs = phase['ddocs']
    if 'xdcr' in phase:
        xdcr = phase['xdcr']
    if 'teardown' in phase:
        teardown = phase['teardown']

    logger.error('\n')
    logger.error("Running Phase: %s (%s)" % (name, desc))

    if buckets is not None:
        perform_bucket_create_tasks(buckets)

    if ddocs is not None:
        perform_view_tasks(ddocs)

    if xdcr is not None:
        perform_xdcr_tasks(xdcr)

    if cluster is not None:
        if isinstance(cluster, list):
            cluster = cluster[0]  # there can only be one cluster task-per-site

        clusterMsg = parseClusterReq(cluster)
        perform_admin_tasks(clusterMsg)
        rebalance_required = clusterMsg['rebalance_required']

    if workload is not None:
        workloadIds = activateWorkloads(workload)

    if query is not None:
        queryIds = activateQueries(query)

    if teardown is not None:
        perform_teardown_tasks(teardown)

    # monitor phase
    phase_status = monitorPhase(runTime, workloadIds, rebalance_required,
                                queryIds)

    # phase complete: #TODO stat report
    time.sleep(5)

    return phase_status
Пример #4
0
def runPhase(name, phase):

    ddocs = workload = workloadIds = cluster = query = queryIds = buckets = None
    docTemplate = "default"
    rebalance_required = False

    name = "<phase name>"
    desc = "<phase description>"

    # default time a workload is run without any conditions in seconds
    runTime = 10

    if 'name' in phase:
        name = phase['name']
    if 'desc' in phase:
        desc = phase['desc']
    if 'cluster' in phase:
        cluster = phase['cluster']
    if 'workload' in phase:
        workload = phase['workload']
    if 'query' in phase:
        query = phase['query']
    if 'runtime' in phase:
        runTime = int(phase['runtime'])
    if 'buckets' in phase:
        buckets = phase['buckets']
    if 'ddocs' in phase:
        ddocs = phase['ddocs']
    if 'xdcr' in phase:
        xdcr = phase['xdcr']

    logger.error('\n')
    logger.error("Running Phase: %s (%s)" % (name, desc))

    if buckets is not None:
        perform_bucket_create_tasks(buckets)

    if ddocs is not None:
        perform_view_tasks(ddocs)

    if xdcr is not None:
        perform_xdcr_tasks(xdcr)

    if cluster is not None:

        clusterMsg = parseClusterReq(cluster)
        perform_admin_tasks(clusterMsg)
        rebalance_required = clusterMsg['rebalance_required']

    if workload is not None:
        workloadIds = activateWorkloads(workload)

    if query is not None:
        queryIds = activateQueries(query)

    # monitor phase
    phase_status = monitorPhase(runTime, workloadIds, rebalance_required, queryIds)

    # phase complete: #TODO stat report
    time.sleep(5)

    return phase_status