Ejemplo n.º 1
0
def getAllocations():
    """Returns a list of allocation objects
    @rtype:  list<Allocation>
    @return: List of allocation objects"""
    allocationSeq = Cuebot.getStub('allocation').GetAll(
        facility_pb2.AllocGetAllRequest(), timeout=Cuebot.Timeout).allocations
    return [Allocation(a) for a in allocationSeq.allocations]
Ejemplo n.º 2
0
def findAllocation(name):
    """Returns the Allocation object that matches the name.
    @type  name: str
    @param name: The name of the allocation
    @rtype:  Allocation
    @return: Allocation object"""
    return Allocation(
        Cuebot.getStub('allocation').Find(
            facility_pb2.AllocFindRequest(name=name),
            timeout=Cuebot.Timeout).allocation)
Ejemplo n.º 3
0
def createAllocation(name, tag, facility):
    """Creates and returns an allocation.
    The host tag will be the lowercase of the allocation name.
    @type  name: str
    @param name: The name of the allocation
    @type  tag: str
    @param tag: The tag for the allocation
    @rtype:  Allocation
    @return: The created allocation object"""
    return Allocation(
        Cuebot.getStub('allocation').Create(facility_pb2.AllocCreateRequest(
            name=name, tag=tag, facility=facility),
                                            timeout=Cuebot.Timeout).allocation)
Ejemplo n.º 4
0
def getAllocation(allocId):
    return Allocation(
        Cuebot.getStub('allocation').Get(
            facility_pb2.AllocGetRequest(id=allocId),
            timeout=Cuebot.Timeout).allocation)