Examples of AllocatedResource


Examples of eu.stratosphere.nephele.instance.AllocatedResource

      assertEquals(2, allocatedResources.size());
     
      Iterator<AllocatedResource> it = allocatedResources.iterator();
      Set<AllocationID> allocationIDs = new HashSet<AllocationID>();
      while (it.hasNext()) {
        AllocatedResource allocatedResource = it.next();
        if (ConfigConstants.DEFAULT_INSTANCE_TYPE.equals(allocatedResource.getInstance().getType().getIdentifier())) {
          fail("Allocated unexpected instance of type "
            + allocatedResource.getInstance().getType().getIdentifier());
        }

        if (allocationIDs.contains(allocatedResource.getAllocationID())) {
          fail("Discovered allocation ID " + allocatedResource.getAllocationID() + " at least twice");
        } else {
          allocationIDs.add(allocatedResource.getAllocationID());
        }
      }

      // Try to allocate more resources which must result in an error
      try {
        InstanceRequestMap instancem = new InstanceRequestMap();
        instancem.setNumberOfInstances(cm.getDefaultInstanceType(), 1);
        cm.requestInstance(jobID, conf, instancem, null);

        fail("ClusterManager allowed to request more instances than actually available");

      } catch (InstanceException ie) {
        // Exception is expected and correct behavior here
      }

      // Release all allocated resources
      it = allocatedResources.iterator();
      while (it.hasNext()) {
        final AllocatedResource allocatedResource = it.next();
        cm.releaseAllocatedResource(jobID, conf, allocatedResource);
      }
     
      // Now further allocations should be possible
     
View Full Code Here

Examples of eu.stratosphere.nephele.instance.AllocatedResource

    this.allocatedResources = new ArrayList<AllocatedResource>();
    try {
      final InstanceConnectionInfo ici = new InstanceConnectionInfo(Inet4Address.getLocalHost(), 1, 1);
      final NetworkTopology nt = new NetworkTopology();
      final TestInstance ti = new TestInstance(INSTANCE_TYPE, ici, nt.getRootNode(), nt, hd);
      this.allocatedResources.add(new AllocatedResource(ti, INSTANCE_TYPE, new AllocationID()));
    } catch (UnknownHostException e) {
      throw new RuntimeException(StringUtils.stringifyException(e));
    }
  }
View Full Code Here

Examples of eu.stratosphere.nephele.instance.AllocatedResource

        synchronized (stage) {

          for (final AllocatedResource allocatedResource : allocatedResources) {

            AllocatedResource resourceToBeReplaced = null;
            // Important: only look for instances to be replaced in the current stage
            final Iterator<ExecutionGroupVertex> groupIterator = new ExecutionGroupVertexIterator(eg, true,
              stage.getStageNumber());
            while (groupIterator.hasNext()) {

              final ExecutionGroupVertex groupVertex = groupIterator.next();
              for (int i = 0; i < groupVertex.getCurrentNumberOfGroupMembers(); ++i) {

                final ExecutionVertex vertex = groupVertex.getGroupMember(i);

                if (vertex.getExecutionState() == ExecutionState.SCHEDULED
                  && vertex.getAllocatedResource() != null) {
                  // In local mode, we do not consider any topology, only the instance type
                  if (vertex.getAllocatedResource().getInstanceType().equals(
                    allocatedResource.getInstanceType())) {
                    resourceToBeReplaced = vertex.getAllocatedResource();
                    break;
                  }
                }
              }

              if (resourceToBeReplaced != null) {
                break;
              }
            }

            // For some reason, we don't need this instance
            if (resourceToBeReplaced == null) {
              LOG.error("Instance " + allocatedResource.getInstance() + " is not required for job"
                + eg.getJobID());
              try {
                getInstanceManager().releaseAllocatedResource(jobID, eg.getJobConfiguration(),
                  allocatedResource);
              } catch (InstanceException e) {
                LOG.error(e);
              }
              return;
            }

            // Replace the selected instance
            final Iterator<ExecutionVertex> it = resourceToBeReplaced.assignedVertices();
            while (it.hasNext()) {
              final ExecutionVertex vertex = it.next();
              vertex.setAllocatedResource(allocatedResource);
              vertex.updateExecutionState(ExecutionState.ASSIGNED);
            }
View Full Code Here

Examples of eu.stratosphere.nephele.instance.AllocatedResource

            // Assign vertices back to a dummy resource.
            final DummyInstance dummyInstance = DummyInstance.createDummyInstance(allocatedResource
              .getInstance()
              .getType());
            final AllocatedResource dummyResource = new AllocatedResource(dummyInstance,
              allocatedResource.getInstanceType(), new AllocationID());

            while (vertexIter.hasNext()) {
              final ExecutionVertex vertex = vertexIter.next();
              vertex.setAllocatedResource(dummyResource);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.