Search in sources :

Example 1 with ComputeNodeType

use of es.bsc.compss.types.resources.jaxb.ComputeNodeType in project compss by bsc-wdc.

the class ResourcesFileTest method computeNodeCreationWithGATAndRead.

@Test
public void computeNodeCreationWithGATAndRead() throws SAXException, JAXBException, ResourcesFileValidationException {
    int cu = 5;
    float speed = 2.6f;
    String nodeName = "blablahost";
    String procName = "Proc1";
    String arch = "amd64";
    String key = "procKey";
    String value = "procValue";
    float memSize = 32.5f;
    float storageSize = 256.0f;
    String osType = OSTypeType.LINUX.value();
    String adaptorName = "gat";
    // int minPort = 20;
    // int maxPort = 40;
    // String executor ="ssh";
    boolean batch = true;
    String queue = "default";
    List<String> queues = new ArrayList<String>();
    queues.add(queue);
    boolean interactive = true;
    String gatprop = "sshtrillead";
    String user = "user";
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
    resources.addComputeNode(nodeName, procName, cu, arch, speed, null, -1f, ResourcesFile.createProcessorProperty(key, value), adaptorName, batch, queues, interactive, gatprop, user, memSize, null, storageSize, null, osType, null, null);
    ComputeNodeType cn = resources.getComputeNode(nodeName);
    ProcessorType procExtracted = resources.getProcessors(cn).get(0);
    assertEquals(procName, procExtracted.getName());
    assertEquals(cu, resources.getProcessorComputingUnits(procExtracted));
    assertEquals(arch, resources.getProcessorArchitecture(procExtracted));
    assertEquals(speed, resources.getProcessorSpeed(procExtracted), 0);
    assertEquals("CPU", resources.getProcessorType(procExtracted));
    assertEquals(key, resources.getProcessorProperty(procExtracted).getKey());
    assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
    assertEquals(memSize, resources.getMemorySize(cn), 0);
    assertEquals(storageSize, resources.getStorageSize(cn), 0);
    assertEquals(osType, resources.getOperatingSystemType(cn));
    assertEquals(String.class, resources.getAdaptorProperties(cn, adaptorName).getClass());
    assertEquals(gatprop, resources.getAdaptorProperties(cn, adaptorName));
    assertEquals(queue, resources.getAdaptorQueues(cn, adaptorName).get(0));
}
Also used : ComputeNodeType(es.bsc.compss.types.resources.jaxb.ComputeNodeType) ProcessorType(es.bsc.compss.types.resources.jaxb.ProcessorType) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) ArrayList(java.util.ArrayList) File(java.io.File) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) Test(org.junit.Test)

Example 2 with ComputeNodeType

use of es.bsc.compss.types.resources.jaxb.ComputeNodeType in project compss by bsc-wdc.

the class ResourcesFileTest method computeNodeCreationWithNIOAndRead.

@Test
public void computeNodeCreationWithNIOAndRead() throws SAXException, JAXBException, ResourcesFileValidationException {
    int cu = 5;
    float speed = 2.6f;
    String nodeName = "blablahost";
    String procName = "Proc1";
    String arch = "amd64";
    String type = "GPU";
    float internalMemorySize = 0.01f;
    String key = "procKey";
    String value = "procValue";
    float memSize = 32.5f;
    float storageSize = 256.0f;
    String osType = OSTypeType.LINUX.value();
    String adaptorName = "nio";
    int minPort = 20;
    int maxPort = 40;
    String executor = "ssh";
    // boolean batch = true;
    // String queue = "default";
    // boolean interactive = true;
    // String gatprop = "sshtrillead";
    String user = "user";
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
    resources.addComputeNode(nodeName, procName, cu, arch, speed, type, internalMemorySize, ResourcesFile.createProcessorProperty(key, value), adaptorName, maxPort, minPort, executor, user, memSize, null, storageSize, null, osType, null, null);
    ComputeNodeType cn = resources.getComputeNode(nodeName);
    ProcessorType procExtracted = resources.getProcessors(cn).get(0);
    assertEquals(procName, procExtracted.getName());
    assertEquals(cu, resources.getProcessorComputingUnits(procExtracted));
    assertEquals(arch, resources.getProcessorArchitecture(procExtracted));
    assertEquals(speed, resources.getProcessorSpeed(procExtracted), 0);
    assertEquals(type, resources.getProcessorType(procExtracted));
    assertEquals(internalMemorySize, resources.getProcessorMemorySize(procExtracted), 0);
    assertEquals(key, resources.getProcessorProperty(procExtracted).getKey());
    assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
    assertEquals(memSize, resources.getMemorySize(cn), 0);
    assertEquals(storageSize, resources.getStorageSize(cn), 0);
    assertEquals(osType, resources.getOperatingSystemType(cn));
    assertEquals(NIOAdaptorProperties.class, resources.getAdaptorProperties(cn, adaptorName).getClass());
    assertEquals(minPort, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getMinPort());
    assertEquals(maxPort, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getMaxPort());
    assertEquals(executor, ((NIOAdaptorProperties) resources.getAdaptorProperties(cn, adaptorName)).getRemoteExecutionCommand());
}
Also used : ComputeNodeType(es.bsc.compss.types.resources.jaxb.ComputeNodeType) ProcessorType(es.bsc.compss.types.resources.jaxb.ProcessorType) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) File(java.io.File) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) Test(org.junit.Test)

Example 3 with ComputeNodeType

use of es.bsc.compss.types.resources.jaxb.ComputeNodeType in project compss by bsc-wdc.

the class ResourcesFileTest method staticProcessorAdaptorComputeNodeCreationAndRead.

@Test
public void staticProcessorAdaptorComputeNodeCreationAndRead() throws SAXException, JAXBException, ResourcesFileValidationException {
    int cu = 5;
    float speed = 2.6f;
    String nodeName = "blablahost";
    String procName = "Proc1";
    String arch = "amd64";
    String key = "procKey";
    String value = "procValue";
    String adaptorName = "nio";
    boolean batch = false;
    boolean interactive = true;
    String gatprop = "gat_prop";
    String user = "user";
    ProcessorPropertyType pp = ResourcesFile.createProcessorProperty(key, value);
    ProcessorType proc = ResourcesFile.createProcessor(procName, cu, arch, speed, "CPU", 0.0f, pp);
    AdaptorType ad = ResourcesFile.createAdaptor(adaptorName, batch, null, interactive, gatprop, user);
    String xsd_path = new File(SCHEMA_PATH).toURI().getPath();
    // Instantiate ResourcesFile
    ResourcesFile resources = new ResourcesFile(xsd_path, LOGGER);
    List<ProcessorType> processors = new LinkedList<ProcessorType>();
    processors.add(proc);
    List<AdaptorType> adaptors = new LinkedList<AdaptorType>();
    adaptors.add(ad);
    resources.addComputeNode(nodeName, processors, adaptors);
    ComputeNodeType cn = resources.getComputeNode(nodeName);
    ProcessorType procExtracted = resources.getProcessors(cn).get(0);
    assertEquals(procName, procExtracted.getName());
    assertEquals(cu, resources.getProcessorComputingUnits(procExtracted));
    assertEquals(arch, resources.getProcessorArchitecture(procExtracted));
    assertEquals(speed, resources.getProcessorSpeed(procExtracted), 0);
    assertEquals("CPU", resources.getProcessorType(procExtracted));
    assertEquals(-1.0f, resources.getProcessorMemorySize(procExtracted), 0);
    assertEquals(key, resources.getProcessorProperty(procExtracted).getKey());
    assertEquals(value, resources.getProcessorProperty(procExtracted).getValue());
}
Also used : AdaptorType(es.bsc.compss.types.resources.jaxb.AdaptorType) ComputeNodeType(es.bsc.compss.types.resources.jaxb.ComputeNodeType) ProcessorType(es.bsc.compss.types.resources.jaxb.ProcessorType) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) ProcessorPropertyType(es.bsc.compss.types.resources.jaxb.ProcessorPropertyType) LinkedList(java.util.LinkedList) File(java.io.File) ResourcesFile(es.bsc.compss.types.resources.ResourcesFile) Test(org.junit.Test)

Aggregations

ResourcesFile (es.bsc.compss.types.resources.ResourcesFile)3 ComputeNodeType (es.bsc.compss.types.resources.jaxb.ComputeNodeType)3 ProcessorType (es.bsc.compss.types.resources.jaxb.ProcessorType)3 File (java.io.File)3 Test (org.junit.Test)3 AdaptorType (es.bsc.compss.types.resources.jaxb.AdaptorType)1 ProcessorPropertyType (es.bsc.compss.types.resources.jaxb.ProcessorPropertyType)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1