Examples of InstanceTypeDescription


Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

  {
    if (types == null || types.size() < 1) {
      throw new IllegalArgumentException("No instance type found.");
    }
   
    InstanceTypeDescription retValue = null;
    long totalMemory = 0;
    int numInstances = 0;
   
    final Iterator<InstanceTypeDescription> it = types.values().iterator();
    while(it.hasNext())
    {
      final InstanceTypeDescription descr = it.next();
     
      // skip instances for which no hardware description is available
      // this means typically that no
      if (descr.getHardwareDescription() == null || descr.getInstanceType() == null) {
        continue;
      }
     
      final int curInstances = descr.getMaximumNumberOfAvailableInstances();
      final long curMemory = curInstances * descr.getHardwareDescription().getSizeOfFreeMemory();
     
      // get, if first, or if it has more instances and not less memory, or if it has significantly more memory
      // and the same number of cores still
      if ( (retValue == null) ||
        (curInstances > numInstances && (int) (curMemory * 1.2f) > totalMemory) ||
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

      } else {

        if (highestAccommodationIndex < i) { // Since highestAccommodationIndex smaller than my index, the
                            // target instance must be more powerful

          final InstanceTypeDescription descriptionOfLargerInstanceType = instanceTypeDescriptionList
            .get(highestAccommodationIndex);
          if (descriptionOfLargerInstanceType.getHardwareDescription() != null) {
            final HardwareDescription hardwareDescriptionOfLargerInstanceType = descriptionOfLargerInstanceType
              .getHardwareDescription();

            final int numCores = hardwareDescriptionOfLargerInstanceType.getNumberOfCPUCores()
              / highestAccommodationNumber;
            final long physMem = hardwareDescriptionOfLargerInstanceType.getSizeOfPhysicalMemory()
              / highestAccommodationNumber;
            final long freeMem = hardwareDescriptionOfLargerInstanceType.getSizeOfFreeMemory()
              / highestAccommodationNumber;

            pessimisticHardwareDescription = HardwareDescriptionFactory.construct(numCores, physMem,
              freeMem);
          }
        }
      }

      instanceTypeDescriptionList.add(InstanceTypeDescriptionFactory.construct(currentInstanceType,
        pessimisticHardwareDescription, numberOfInstances[i]));
    }

    final Iterator<InstanceTypeDescription> it = instanceTypeDescriptionList.iterator();
    while (it.hasNext()) {

      final InstanceTypeDescription itd = it.next();
      this.instanceTypeDescriptionMap.put(itd.getInstanceType(), itd);
    }
  }
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

   * Constructs a new test instance manager
   */
  public TestInstanceManager() {

    final HardwareDescription hd = HardwareDescriptionFactory.construct(1, 1L, 1L);
    final InstanceTypeDescription itd = InstanceTypeDescriptionFactory.construct(INSTANCE_TYPE, hd, 1);
    instanceMap.put(INSTANCE_TYPE, itd);

    this.allocatedResources = new ArrayList<AllocatedResource>();
    try {
      final InstanceConnectionInfo ici = new InstanceConnectionInfo(Inet4Address.getLocalHost(), 1, 1);
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

     
     
      Map<InstanceType, InstanceTypeDescription> instanceTypeDescriptions = cm.getMapOfAvailableInstanceTypes();
      assertEquals(1, instanceTypeDescriptions.size());
     
      InstanceTypeDescription descr = instanceTypeDescriptions.entrySet().iterator().next().getValue();
     
      assertEquals(3, descr.getMaximumNumberOfAvailableInstances());
     
      cm.shutdown();
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

     
     
      Map<InstanceType, InstanceTypeDescription> instanceTypeDescriptions = cm.getMapOfAvailableInstanceTypes();
      assertEquals(1, instanceTypeDescriptions.size());
     
      InstanceTypeDescription descr = instanceTypeDescriptions.entrySet().iterator().next().getValue();
     
      assertEquals(2, descr.getMaximumNumberOfAvailableInstances());
     
     
      // allocate something
      JobID jobID = new JobID();
      Configuration conf = new Configuration();
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

     
     
      Map<InstanceType, InstanceTypeDescription> instanceTypeDescriptions = cm.getMapOfAvailableInstanceTypes();
      assertEquals(1, instanceTypeDescriptions.size());
     
      InstanceTypeDescription descr = instanceTypeDescriptions.entrySet().iterator().next().getValue();
      assertEquals(3, descr.getMaximumNumberOfAvailableInstances());
     
      // request some instances
      JobID jobID = new JobID();
      Configuration conf = new Configuration();

      InstanceRequestMap instancem = new InstanceRequestMap();
      instancem.setNumberOfInstances(cm.getDefaultInstanceType(), 1);
      cm.requestInstance(jobID, conf, instancem, null);
     
      ClusterManagerTestUtils.waitForInstances(jobID, testInstanceListener, 1, 1000);
      assertEquals(1, testInstanceListener.getNumberOfAllocatedResourcesForJob(jobID));
     
      // wait for the cleanup to kick in
      Thread.sleep(2000 * CLEANUP_INTERVAL);
     
      // check that the instances are gone
      ClusterManagerTestUtils.waitForInstances(jobID, testInstanceListener, 0, 1000);
      assertEquals(0, testInstanceListener.getNumberOfAllocatedResourcesForJob(jobID));
     
     
      instanceTypeDescriptions = cm.getMapOfAvailableInstanceTypes();
      assertEquals(1, instanceTypeDescriptions.size());
     
      descr = instanceTypeDescriptions.entrySet().iterator().next().getValue();
      assertEquals(0, descr.getMaximumNumberOfAvailableInstances());
     
      cm.shutdown();
    }
    catch (Exception e) {
      System.err.println(e.getMessage());
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

      final Iterator<Map.Entry<InstanceType, Integer>> it = instanceRequestMap.getMinimumIterator();
      while (it.hasNext()) {

        final Map.Entry<InstanceType, Integer> entry = it.next();

        final InstanceTypeDescription descr = availableInstances.get(entry.getKey());
        if (descr == null) {
          throw new SchedulingException("Unable to schedule job: No instance of type " + entry.getKey()
              + " available");
        }

        if (descr.getMaximumNumberOfAvailableInstances() != -1
            && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
          throw new SchedulingException("Unable to schedule job: " + entry.getValue().intValue()
              + " instances of type " + entry.getKey() + " required, but only "
              + descr.getMaximumNumberOfAvailableInstances() + " are available");
        }
      }
    }

    // Subscribe to job status notifications
View Full Code Here

Examples of eu.stratosphere.nephele.instance.InstanceTypeDescription

      final Iterator<Map.Entry<InstanceType, Integer>> it = instanceRequestMap.getMinimumIterator();
      while (it.hasNext()) {

        final Map.Entry<InstanceType, Integer> entry = it.next();

        final InstanceTypeDescription descr = availableInstances.get(entry.getKey());
        if (descr == null) {
          throw new SchedulingException("Unable to schedule job: No instance of type " + entry.getKey()
              + " available");
        }

        if (descr.getMaximumNumberOfAvailableInstances() != -1
            && descr.getMaximumNumberOfAvailableInstances() < entry.getValue().intValue()) {
          throw new SchedulingException("Unable to schedule job: " + entry.getValue().intValue()
              + " instances of type " + entry.getKey() + " required, but only "
              + descr.getMaximumNumberOfAvailableInstances() + " are available");
        }
      }
    }

    // Subscribe to job status notifications
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.