コード例 #1
0
ファイル: plan_query.py プロジェクト: richardxx/tingDB
def stop_plan(plan_name, _type="servers", try_times = 5):
    while try_times > 0:
        response = tingDB_service.send_request_to_op(plan_name, "op-stop", _type)
        if response != "":
            return response

        time.sleep(1)
        try_times -= 1

    return ""
コード例 #2
0
ファイル: plan_query.py プロジェクト: richardxx/tingDB
def start_plan(plan_name, _type="servers", try_times = 5):
    """
        _type can only be servers and clusters.
    """
    while try_times > 0:
        response = tingDB_service.send_request_to_op(plan_name, "op-start", _type)
        if response != "":
            return response

        time.sleep(1)
        try_times -= 1

    return ""
コード例 #3
0
ファイル: plan_query.py プロジェクト: richardxx/tingDB
def get_URIs_for_user(username):
    """
        Retrieve the URIs for all the plans for a given user.
    """
    plans = get_plans_for_user(username)
    URIs = []

    for plan in plans:
        plan_name = plan["_id"]
        print plan_name
        uri = tingDB_service.send_request_to_op(plan_name, "op-geturi")
        URIs.append(uri)

    return URIs