Пример #1
0
def allocation(name):
    """
    Get information for a specified cluster and return
    it in as json or jsonp

    :return: json or jsonp status of cluster
    """
    result = {}
    vc3_client = get_vc3_client()
    allocations = vc3_client.listAllocations()
    for x in allocations:
        if x.name == name:
            sanitized_obj = {
                'name': x.name,
                'state': x.state,
                'action': x.action,
                'owner': x.owner,
                'displayname': x.displayname,
                'description': x.description,
                'statereason': x.state_reason,
                'pubtoken': x.pubtoken
            }
            if x.pubtoken:
                sanitized_obj['pubtoken'] = base64.b64decode(
                    x.pubtoken).rstrip('\n')
            return flask.jsonify(sanitized_obj)
    return flask.jsonify(result), 404
Пример #2
0
 def decorated_function(*args, **kwargs):
     vc3_client = get_vc3_client()
     projects = vc3_client.listProjects()
     for project in projects:
         if (session['name'] == project.owner
                 or session['name'] in project.members):
             return f(*args, **kwargs)
     flash('You must be within a project in order to proceed.', 'warning')
     return redirect(url_for('list_projects', next=request.url))
Пример #3
0
 def decorated_function(*args, **kwargs):
     vc3_client = get_vc3_client()
     allocations = vc3_client.listAllocations()
     for allocation in allocations:
         if (session['name'] == allocation.owner
                 and allocation.state == "validated"):
             return f(*args, **kwargs)
     flash('Please wait until your allocation is validated.', 'warning')
     return redirect(url_for('list_allocations', next=request.url))
Пример #4
0
 def decorated_function(*args, **kwargs):
     vc3_client = get_vc3_client()
     allocations = vc3_client.listAllocations()
     for allocation in allocations:
         if (session['name'] == allocation.owner and
                 allocation.state == "ready"):
             return f(*args, **kwargs)
     flash('You must have a validated allocation to create a project.', 'warning')
     return redirect(url_for('list_allocations', next=request.url))
Пример #5
0
def virtual_cluster(name):
    """
    Get information for a specified cluster and return
    it in as json or jsonp

    :return: json or jsonp status of cluster
    """
    result = {}
    vc3_client = get_vc3_client()
    virtual_clusters = vc3_client.listRequests()
    nodesets = vc3_client.listNodesets()
    for vc in virtual_clusters:
        if vc.name == name:
            sanitized_obj = {
                'name': vc.name,
                'state': vc.state,
                'cluster': vc.cluster,
                'statusraw': vc.statusraw,
                'statusinfo': vc.statusinfo,
                'displayname': vc.displayname,
                'description': vc.description,
                'statereason': vc.state_reason,
                'action': vc.action,
                'headnode': vc.headnode
            }
            if vc.statusinfo is not None:
                sanitized_obj['statusinfo_error'] = vc.statusinfo[
                    vc.statusinfo.keys()[0]]['error']
                sanitized_obj['statusinfo_idle'] = vc.statusinfo[
                    vc.statusinfo.keys()[0]]['idle']
                sanitized_obj['statusinfo_node_number'] = vc.statusinfo[
                    vc.statusinfo.keys()[0]]['node_number']
                sanitized_obj['statusinfo_requested'] = vc.statusinfo[
                    vc.statusinfo.keys()[0]]['requested']
                sanitized_obj['statusinfo_running'] = vc.statusinfo[
                    vc.statusinfo.keys()[0]]['running']
            for nodeset in nodesets:
                if nodeset.name == vc.headnode:
                    sanitized_obj['headnode_app_host'] = nodeset.app_host
                    sanitized_obj['headnode_app_type'] = nodeset.app_type
                    sanitized_obj['headnode_state'] = nodeset.state
                    sanitized_obj[
                        'headnode_state_reason'] = nodeset.state_reason

            return flask.jsonify(sanitized_obj)
    return flask.jsonify(result), 404
Пример #6
0
def allocation(name):
    """
    Get information for a specified cluster and return
    it in as json or jsonp

    :return: json or jsonp status of cluster
    """
    result = {}
    vc3_client = get_vc3_client()
    allocations = vc3_client.listAllocations()
    for x in allocations:
        if x.name == name:
            sanitized_obj = {
                'name': x.name,
                'state': x.state,
                'owner': x.owner,
                'displayname': x.displayname,
                'description': x.description
            }
            return flask.jsonify(sanitized_obj)
    return flask.jsonify(result), 404
Пример #7
0
def virtual_cluster(name):
    """
    Get information for a specified cluster and return
    it in as json or jsonp

    :return: json or jsonp status of cluster
    """
    result = {}
    vc3_client = get_vc3_client()
    virtual_clusters = vc3_client.listRequests()
    for vc in virtual_clusters:
        if vc.name == name:
            sanitized_obj = {
                'name': vc.name,
                'state': vc.state,
                'statusraw': vc.statusraw,
                'statusinfo': vc.statusinfo,
                'displayname': vc.displayname,
                'description': vc.description,
                'statereason': vc.state_reason
            }
            return flask.jsonify(sanitized_obj)
    return flask.jsonify(result), 404