[477] | 1 | package schedframe.scheduling.manager.resources; |
---|
| 2 | |
---|
| 3 | import java.util.ArrayList; |
---|
| 4 | import java.util.List; |
---|
| 5 | import java.util.Properties; |
---|
| 6 | |
---|
| 7 | import schedframe.exceptions.ResourceException; |
---|
| 8 | import schedframe.resources.StandardResourceType; |
---|
| 9 | import schedframe.resources.computing.ComputingNode; |
---|
| 10 | import schedframe.resources.computing.ComputingResource; |
---|
| 11 | import schedframe.resources.computing.Processor; |
---|
| 12 | import schedframe.scheduling.Scheduler; |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | public class ClusterResourceManager extends LocalResourceManager { |
---|
| 16 | |
---|
| 17 | public ClusterResourceManager(List<ComputingResource> resources, List<Scheduler> schedulers, ManagedResources managedResources) { |
---|
| 18 | super(resources, schedulers, managedResources.getResourceUnits()); |
---|
| 19 | // TODO Auto-generated constructor stub |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | @SuppressWarnings("unchecked") |
---|
| 23 | public List<ComputingNode> getComputingNodes(){ |
---|
| 24 | try { |
---|
| 25 | return (List<ComputingNode>) getResourcesOfType(StandardResourceType.ComputingNode); |
---|
| 26 | } catch (ResourceException e) { |
---|
| 27 | return new ArrayList<ComputingNode>(); |
---|
| 28 | } |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | @SuppressWarnings("unchecked") |
---|
| 32 | public List<Processor> getProcessors(){ |
---|
| 33 | try { |
---|
| 34 | return (List<Processor>) getResourcesOfType(StandardResourceType.Processor); |
---|
| 35 | } catch (Exception e) { |
---|
| 36 | return new ArrayList<Processor>(); |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | @SuppressWarnings("unchecked") |
---|
| 41 | public List<ComputingNode> getComputingNodes(Properties properties){ |
---|
| 42 | properties.setProperty("type", StandardResourceType.ComputingNode.toString()); |
---|
| 43 | return (List<ComputingNode>) filterResources(properties); |
---|
| 44 | |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | } |
---|