Ejemplo n.º 1
0
 def reparentHosts(self, hosts):
     """Moves the given hosts to the allocation
     @type  hosts: list<HostInterfacePrx or Host or id or str hostname>
     @param hosts: The hosts to move to this allocation
     """
     hostSeq = host_pb2.HostSeq()
     hostSeq.hosts.extend(hosts)
     self.stub.ReparentHosts(facility_pb2.AllocReparentHostsRequest(
         allocation=self.data, hosts=hostSeq),
                             timeout=Cuebot.Timeout)
Ejemplo n.º 2
0
 def reparentHosts(self, hosts):
     """Moves the given hosts to the allocation
     @type  hosts: list<opencue.wrappers.host.Host>
     @param hosts: The hosts to move to this allocation
     """
     hostSeq = host_pb2.HostSeq()
     hostSeq.hosts.extend([host.data for host in hosts])
     self.stub.ReparentHosts(
         facility_pb2.AllocReparentHostsRequest(allocation=self.data, hosts=hostSeq),
         timeout=Cuebot.Timeout
     )
Ejemplo n.º 3
0
    def reparentHosts(self, hosts):
        """Moves the given hosts into the allocation.

        :type  hosts: list<opencue.wrappers.host.Host>
        :param hosts: the hosts to move to this allocation
        """
        hostSeq = host_pb2.HostSeq()
        # pylint: disable=no-member
        hostSeq.hosts.extend([host.data for host in hosts])
        # pylint: enable=no-member
        self.stub.ReparentHosts(facility_pb2.AllocReparentHostsRequest(
            allocation=self.data, hosts=hostSeq),
                                timeout=Cuebot.Timeout)
Ejemplo n.º 4
0
    def testGetHosts(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = host_pb2.HostGetHostsResponse(
            hosts=host_pb2.HostSeq(hosts=[host_pb2.Host(name=TEST_HOST_NAME)]))
        getStubMock.return_value = stubMock

        hosts = opencue.api.getHosts(name=[TEST_HOST_NAME])

        stubMock.GetHosts.assert_called_with(
            host_pb2.HostGetHostsRequest(r=host_pb2.HostSearchCriteria(hosts=[TEST_HOST_NAME])),
            timeout=mock.ANY)
        self.assertEqual(1, len(hosts))
        self.assertEqual(TEST_HOST_NAME, hosts[0].name())
Ejemplo n.º 5
0
    def testGetHosts(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = host_pb2.OwnerGetHostsResponse(
            hosts=host_pb2.HostSeq(hosts=[host_pb2.Host(id=TEST_HOST_ID)]))
        getStubMock.return_value = stubMock

        owner = opencue.wrappers.owner.Owner(
            host_pb2.Owner(id=TEST_OWNER_ID, name=TEST_OWNER_NAME))
        hosts = owner.getHosts()

        stubMock.GetHosts.assert_called_with(
            host_pb2.OwnerGetHostsRequest(owner=owner.data), timeout=mock.ANY)
        self.assertEqual(len(hosts), 1)
        self.assertEqual(hosts[0].id(), TEST_HOST_ID)
Ejemplo n.º 6
0
 def testReparentHostIds(self, getStubMock):
     stubMock = mock.Mock()
     stubMock.ReparentHosts.return_value = facility_pb2.AllocReparentHostsResponse()
     getStubMock.return_value = stubMock
 
     alloc = opencue.wrappers.allocation.Allocation(
         facility_pb2.Allocation(name=TEST_ALLOC_NAME))
     hostIds = [TEST_HOST_ID]
     alloc.reparentHostIds(hostIds)
     hosts = [host_pb2.Host(id=TEST_HOST_ID)]
 
     stubMock.ReparentHosts.assert_called_with(
         facility_pb2.AllocReparentHostsRequest(
             allocation=alloc.data, hosts=host_pb2.HostSeq(hosts=hosts)), timeout=mock.ANY)
Ejemplo n.º 7
0
    def testGetHosts(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.GetHosts.return_value = facility_pb2.AllocGetHostsResponse(
            hosts=host_pb2.HostSeq(hosts=[host_pb2.Host(name=TEST_HOST_NAME)]))
        getStubMock.return_value = stubMock

        alloc = opencue.wrappers.allocation.Allocation(
            facility_pb2.Allocation(name=TEST_ALLOC_NAME))
        hosts = alloc.getHosts()

        stubMock.GetHosts.assert_called_with(
            facility_pb2.AllocGetHostsRequest(allocation=alloc.data),
            timeout=mock.ANY)
        self.assertEqual(len(hosts), 1)
        self.assertEqual(hosts[0].name(), TEST_HOST_NAME)