Пример #1
0
def returnClusterStartTaskIfExists(request):
    persistManager = request.state.persistManager

    try:
        cluster = yield persistManager.loadCluster(
            request.body['cluster_name'], request.body['user_name'])

        if cluster.state in [cluster.TERMINATED, cluster.FAILED]:
            defer.returnValue(request)
        else:
            request.body['task_name'] = cluster.startTask
            defer_pipe.emit(request.update(response=cluster.startTask))
    except persist.ClusterNotFoundError:
        defer.returnValue(request)
Пример #2
0
def returnClusterStartTaskIfExists(request):
    persistManager = request.state.persistManager

    try: 
        cluster = yield persistManager.loadCluster(request.body['cluster_name'],
                                                   request.body['user_name'])

        if cluster.state in [cluster.TERMINATED, cluster.FAILED]:
            defer.returnValue(request)
        else:
            request.body['task_name'] = cluster.startTask
            defer_pipe.emit(request.update(response=cluster.startTask))
    except persist.ClusterNotFoundError:
        defer.returnValue(request)
Пример #3
0
    def _(request):
        if request.body['cluster'] == 'local':
            defer.returnValue(request)
        else:
            clusters = yield clusters_client.listClusters({'cluster_name': request.body['cluster']},
                                                          request.body['user_name'])

            cluster = clusters[0]
            
            ret = yield http.performQuery(cluster['master']['public_dns'],
                                          url,
                                          func.updateDict(request.body, {'cluster': 'local'}),
                                          timeout=10,
                                          tries=3)

            defer_pipe.emit(request.update(response=ret))
Пример #4
0
    def _(request):
        if request.body['cluster'] == 'local':
            defer.returnValue(request)
        else:
            clusters = yield clusters_client.listClusters(
                {'cluster_name': request.body['cluster']},
                request.body['user_name'])

            cluster = clusters[0]

            ret = yield http.performQuery(cluster['master']['public_dns'],
                                          url,
                                          func.updateDict(
                                              request.body,
                                              {'cluster': 'local'}),
                                          timeout=10,
                                          tries=3)

            defer_pipe.emit(request.update(response=ret))
Пример #5
0
def returnClusterImportTaskIfExists(request):
    """Returns the task name of the import cluster operation if it exists 
    already.

    """
    persistManager = request.state.persistManager
    
    try:
        cluster = yield persistManager.loadCluster(request.body['dst_cluster'],
                                                   request.body['user_name'])

        if cluster.state in [cluster.TERMINATED, cluster.FAILED]:
            defer.returnValue(request)
        else:
            # We won't really have an importTask attribute here but will 
            # instead lump the task name under the startTask attribute
            request.body['task_name'] = cluster.startTask
            defer_pipe.emit(request.update(response=cluster.startTask))
    except persist.ClusterNotFoundError:
        defer.returnValue(request)
Пример #6
0
def returnClusterImportTaskIfExists(request):
    """Returns the task name of the import cluster operation if it exists 
    already.

    """
    persistManager = request.state.persistManager

    try:
        cluster = yield persistManager.loadCluster(request.body['dst_cluster'],
                                                   request.body['user_name'])

        if cluster.state in [cluster.TERMINATED, cluster.FAILED]:
            defer.returnValue(request)
        else:
            # We won't really have an importTask attribute here but will
            # instead lump the task name under the startTask attribute
            request.body['task_name'] = cluster.startTask
            defer_pipe.emit(request.update(response=cluster.startTask))
    except persist.ClusterNotFoundError:
        defer.returnValue(request)