Commit fe8dd030 authored by vbanos's avatar vbanos
Browse files

Discovery Test based on ResourceLoader

parent 7aa900aa
......@@ -77,11 +77,11 @@
<artifactId>comm-all</artifactId>
<version>${comm.version}</version>
</dependency>
<dependency>
<!--<dependency>
<groupId>es.bsc.compss</groupId>
<artifactId>compss-agent-commons</artifactId>
<version>${project.version}</version>
</dependency>
</dependency> -->
<!-- JSON -->
<dependency>
<groupId>org.json</groupId>
......
......@@ -62,11 +62,7 @@ import es.bsc.compss.types.resources.Resource;
import es.bsc.compss.types.resources.ResourcesPool;
import es.bsc.compss.types.uri.MultiURI;
import es.bsc.compss.types.uri.SimpleURI;
import es.bsc.compss.util.CoreManager;
import es.bsc.compss.util.ErrorManager;
import es.bsc.compss.util.RuntimeConfigManager;
import es.bsc.compss.util.TraceEvent;
import es.bsc.compss.util.Tracer;
import es.bsc.compss.util.*;
import es.bsc.compss.worker.COMPSsException;
import java.io.File;
......@@ -528,6 +524,10 @@ public class COMPSsRuntimeImpl implements COMPSsRuntime, LoaderAPI, FatalErrorHa
LOGGER.debug("Stopping Monitor...");
runtimeMonitor.shutdown();
}
if (NetworkDiscovery.isEnabled()) {
LOGGER.debug("Stopping Network Discovery....");
NetworkDiscovery.getInstance().stop();
}
// Stop runtime components
LOGGER.debug("Stopping AP...");
......
......@@ -69,6 +69,12 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- <dependency>
<groupId>es.bsc.compss</groupId>
<artifactId>compss-scheduler-commons</artifactId>
<version>2.6.rc2003</version>
<scope>compile</scope>
</dependency> -->
</dependencies>
......
/*
* Copyright 2002-2019 Barcelona Supercomputing Center (www.bsc.es)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package es.bsc.compss.util;
import es.bsc.compss.COMPSsConstants;
import es.bsc.compss.comm.Comm;
import es.bsc.compss.log.Loggers;
import es.bsc.compss.types.project.ProjectFile;
import es.bsc.compss.types.resources.*;
import es.bsc.compss.types.resources.configuration.MethodConfiguration;
import es.bsc.compss.types.resources.jaxb.ComputeNodeType;
import es.bsc.compss.types.resources.jaxb.ResourcesNIOAdaptorProperties;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
//import java.util.*;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import static es.bsc.compss.types.resources.Resource.*;
//import es.bsc.compss.agent.AgentException;
//import es.bsc.compss.agent.rest.types.RESTResource;
//import es.bsc.compss.agent.types.Resource;
//import es.bsc.compss.exceptions.ConstructConfigurationException;
//import es.bsc.compss.types.COMPSsNode;
//import es.bsc.compss.types.project.jaxb.NIOAdaptorProperties;
//import es.bsc.compss.types.resources.jaxb.ResourcesExternalAdaptorProperties;
public class NetworkDiscovery {
private Map<String, es.bsc.compss.types.project.jaxb.ComputeNodeType> projectMap;
private Map<String, ComputeNodeType> resourcesMap;
private Map<String, Thread> pendingResources;
private final Logger LOGGER = LogManager.getLogger(Loggers.DISCOVERY);
private static NetworkDiscovery INSTANCE = null;
public static NetworkDiscovery start(ProjectFile project, ResourcesFile resources) {
return Optional.ofNullable(INSTANCE).orElse(new NetworkDiscovery(project, resources));
}
protected NetworkDiscovery(ProjectFile project, ResourcesFile resources) {
this.projectMap = new HashMap<>();
this.resourcesMap = new HashMap<>();
this.pendingResources = new HashMap<>();
INSTANCE = this;
load(project, resources);
// Runtime.getRuntime().addShutdownHook(new Thread(this::cease));
}
private void load(ProjectFile project, ResourcesFile resources) {
List<Object> resourceList = resources.getResources().getSharedDiskOrDataNodeOrComputeNode();
for (Object o : resourceList) {
if (o instanceof ComputeNodeType) {
ComputeNodeType cnResource = (ComputeNodeType) o;
List<es.bsc.compss.types.project.jaxb.ComputeNodeType> projectList = project.getComputeNodes_list();
Optional<es.bsc.compss.types.project.jaxb.ComputeNodeType> cnProject =
projectList.stream().filter(o2 -> cnResource.getName().equals(o2.getName())).findFirst();
if (cnProject.isPresent()) {
resourcesMap.put(cnResource.getName(), cnResource);
projectMap.put(cnResource.getName(), cnProject.get());
// LOGGER.debug("Resource {} added to discoverable nodes", cnResource.getName());
System.out.println("Resource " + cnResource.getName() + " added to discoverable nodes");
} else {
// LOGGER.debug("Resource {} not found in project file", cnResource.getName());
System.out.println("Resource " + cnResource.getName() + " not found in project file");
}
}
}
}
public void stop() {
this.pendingResources.forEach((k, v) -> v.interrupt());
}
public static NetworkDiscovery getInstance() {
return INSTANCE;
}
public static boolean isEnabled() {
// return enabled;
return INSTANCE != null;
}
private void tryToAddResource(String nodeName) {
try {
// LOGGER.debug("Trying to add dynamic discoverable resource {}", nodeName);
System.out.println("Trying to add dynamic discoverable resource " + nodeName);
ComputeNodeType cnResource = resourcesMap.get(nodeName);
es.bsc.compss.types.project.jaxb.ComputeNodeType cnProject = projectMap.get(nodeName);
MethodWorker worker = ResourceLoader.createMethodWorker(cnProject, cnResource);
MethodResourceDescription mrd = worker.getDescription();
final String adaptor = System.getProperty(COMPSsConstants.COMM_ADAPTOR);
MethodConfiguration config = ResourceLoader.createConfiguration(cnProject, cnResource, mrd, adaptor);
DynamicMethodWorker w = new DynamicMethodWorker(worker.getName(), mrd,
Comm.getAdaptor(adaptor).initWorker(config), worker.getMaxCPUTaskCount(), worker.getMaxGPUTaskCount(),
worker.getMaxFPGATaskCount(), worker.getMaxOthersTaskCount(), new HashMap<>());
ResourceManager.addDynamicWorker(w, mrd);
// LOGGER.debug("{} added as dynamic worker", w.getName());
System.out.println(w.getName() + " added as dynamic worker");
} catch (Exception e) {
e.printStackTrace();
System.out.println("This exception was caught by the NetworkDiscovery");
}
}
/*
* @Override public void run() { System.out.println("Starting discovery"); while (!this.cease) { try {
* Iterator<String> nodeIterator = discoverableNodes.iterator(); while (nodeIterator.hasNext()) { String nodeName =
* nodeIterator.next(); try { ComputeNodeType cnResource = resourcesMap.get(nodeName);
* es.bsc.compss.types.project.jaxb.ComputeNodeType cnProject = projectMap.get(nodeName); MethodWorker worker =
* ResourceLoader.createMethodWorker(cnProject, cnResource); MethodResourceDescription mrd =
* worker.getDescription(); final String adaptor = System.getProperty(COMPSsConstants.COMM_ADAPTOR);
* MethodConfiguration config = ResourceLoader.createConfiguration(cnProject, cnResource, mrd, adaptor);
* DynamicMethodWorker w = new DynamicMethodWorker(worker.getName(), mrd,
* Comm.getAdaptor(adaptor).initWorker(config), worker.getMaxCPUTaskCount(), worker.getMaxGPUTaskCount(),
* worker.getMaxFPGATaskCount(), worker.getMaxOthersTaskCount(), new HashMap<>()); synchronized (this) { if
* (!this.cease) ResourceManager.addDynamicWorker(w, mrd); } // LOGGER.debug("{} added as dynamic worker",
* w.getName()); System.out.println(w.getName() + " added as dynamic worker"); } catch (Exception e) {
* e.printStackTrace(); } // resourceAttempts.add(cnResource.getName()); } // LOGGER.debug("Waiting 15 seconds...");
* System.out.println("Waiting 15 seconds..."); Thread.sleep(15000); } catch (InterruptedException e) {
* e.printStackTrace(); } } }
*/
public void addDiscoverableNode(String name) {
// this.discoverableNodes.add(name);
// LOGGER.debug("Added discoverable node {}", name);
int delay = 15000;
System.out.println("Added discoverable node " + name);
setTimeout(() -> tryToAddResource(name), name, delay);
}
private void setTimeout(Runnable runnable, String name, long delay) {
Thread timeout = new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
} catch (Exception e) {
// Do nothing
} finally {
pendingResources.remove(name);
}
});
pendingResources.put(name, timeout);
timeout.start();
}
public void NetworkDiscovery() throws Exception {
// * @param networkDevices
Resource r = null; // CHEK IF TEST FAIL
String workerName = r.getName();
byte[] localHostIp = InetAddress.getByName(workerName).getAddress();// my code
List<DiscoverNetworkDevice> networkDevices = new ArrayList<>();// my code
for (int i = 1; i < 254; i++) { /// 1 a 255
// Assuming IPV4
localHostIp[3] = (byte) i;
networkDevices.add(new DiscoverNetworkDevice(InetAddress.getByAddress(localHostIp).getHostAddress()));
}
discover(networkDevices);
// Here we identify the Network interfaces presented in out system.
Enumeration<NetworkInterface> e = NetworkInterface.getNetworkInterfaces();
while (e.hasMoreElements()) {
NetworkInterface iface = e.nextElement();
iface.getInterfaceAddresses();
System.out.println(iface);
}
}
public void discover(List<DiscoverNetworkDevice> networkDevices) throws Exception {
List<DiscoverNetworkDevice> discoverDevices =
networkDevices.parallelStream().filter(DiscoverNetworkDevice::ddiscover).collect(Collectors.toList());
for (DiscoverNetworkDevice device : discoverDevices) {
addResources(device.hostIP);
}
}
private static class DiscoverNetworkDevice {
private String hostIP;
private String hostName;
public DiscoverNetworkDevice(String hostIP) {
this.hostIP = hostIP;
}
/**
* Method ddiscover.
*
* @return when return
*/
public boolean ddiscover() {
try {
InetAddress host = InetAddress.getByName(hostIP);
if (host.isReachable(200)) {
hostName = host.getHostName();
return true;
}
} catch (IOException ioe) {
// Ignore
}
return false;
}
@Override
public String toString() {
return this.hostIP;
}
}
public void addResources(String workerName) throws Exception {
MethodResourceDescription description = new MethodResourceDescription();
DynamicMethodWorker worker = ResourceManager.getDynamicResource(workerName);
if (worker != null) {
ResourceManager.increasedDynamicWorker(worker, description);
} else {
String adaptor = "es,bsc.compss.nio.master.NIOAdaptor";
Map<String, Object> projectConf = new HashMap<>();
Map<String, Object> resourcesConf = new HashMap<>();
ResourcesNIOAdaptorProperties resourceProperties = new ResourcesNIOAdaptorProperties();
resourceProperties.setMinPort(43001);
resourceProperties.setMaxPort(43002);
resourcesConf.put("Ports", resourceProperties);
}
}
public void removeResources(String workerName, MethodResourceDescription reduction) throws Exception {
DynamicMethodWorker worker = ResourceManager.getDynamicResource(workerName);
if (worker != null) {
ResourceManager.requestWorkerReduction(worker, reduction);
} else {
throw new Exception("Resource " + workerName + "was not set up for this call. Ignoring request");
}
}
}
/************************************************
* /** VIEJO DISCOVERY Thread Discovery.
*
* @throws Exception when Exception // public void threadDiscovery() throws Exception { // TODO: IP must not be
* hardcoded. Instead, take the IP of the workers, compare with master's network // TODO: interfaces, choose
* which network is going to be used. byte[] localHostIp =
* InetAddress.getByName("192.168.0.1").getAddress();// my code // TODO: This for loop assumes a /24 subnet
* mask // List<DiscoverNetworkDevice> networkDevices = new ArrayList<>();// my code for (int i = 1; i <
* 255; i++) { // Assuming IPV4 localHostIp[3] = (byte) i; networkDevices.add(new
* DiscoverNetworkDevice(InetAddress.getByAddress(localHostIp).getHostAddress())); }
* parallelDiscover(networkDevices); // InetAddress are the IP address to Discover DynamicMethodWorker
* resources = null; InetAddress inetAddress = InetAddress.getByName(resources.getName()); // TODO: This
* loop adds the different IPs of the LOCAL NETWORK INTERFACES as resources. // Here we identify the Network
* interfaces presented in out system. Enumeration e = NetworkInterface.getNetworkInterfaces(); while
* (e.hasMoreElements()) { NetworkInterface n = (NetworkInterface) e.nextElement(); Enumeration ee =
* n.getInetAddresses(); while (ee.hasMoreElements()) { InetAddress i = (InetAddress) ee.nextElement();
* Resource discResource; String nameIP = i.getHostAddress(); MethodResourceDescription des = new
* MethodResourceDescription(); NIOAdaptorProperties adaptorProps = new NIOAdaptorProperties();
* ResourcesExternalAdaptorProperties adaptorResourceProps = new ResourcesExternalAdaptorProperties(); //
* TODO: Resource must NOT be used. The "Resource" class refers to agents, and we don't need it!!!!!
* discResource = new Resource(nameIP, des, System.getProperty(COMPSsConstants.COMM_ADAPTOR), adaptorProps,
* adaptorResourceProps); // ExternalAdaptorResource(name, description, adaptor,
* (ExternalAdaptorProperties)pConf, // (ResourcesExternalAdaptorProperties)rConf);
* addResources(discResource); // REVISAR // Agent.removeResources(discResource); //Remove Resources
* System.out.println(i.getHostAddress()); } } } /** Method discover.
* @param networkDevices when networkDevices // TODO: This method is never used public static void
* discover(List<DiscoverNetworkDevice> networkDevices) { long start = System.currentTimeMillis(); Object[]
* discoveredDevices = networkDevices.stream().filter(nd -> nd.ddiscover()).toArray(); for (Object obj :
* discoveredDevices) { System.out.println(obj); } long end = System.currentTimeMillis();
* System.out.println("Elapsed: " + (end - start)); System.out.println(); } // Method that discover IPs of
* the selected network /** Method parallelDiscover.
* @param networkDevices when networkDevices / // TODO: This function does nothing with the reachable nodes public
* static void parallelDiscover(List<DiscoverNetworkDevice> networkDevices) { long start =
* System.currentTimeMillis(); Object[] discoveredDevices = networkDevices.parallelStream().filter(nd ->
* nd.ddiscover()).toArray(); for (Object obj : discoveredDevices) { System.out.println(obj); } long end =
* System.currentTimeMillis(); System.out.println("Elapsed: " + (end - start)); System.out.println(); } //
* TODO: There is no need to create a nested class just to use a method in line 116. public static class
* DiscoverNetworkDevice { private String hostIp; // TODO: The hostname is useless and never used. private
* String hostName; public DiscoverNetworkDevice(String hostIp) { this.hostIp = hostIp; } /** Method
* ddiscover.
* @return when return / public boolean ddiscover() { try { InetAddress host = InetAddress.getByName(hostIp); if
* (host.isReachable(200)) { hostName = host.getHostName(); return true; } } catch (IOException ioe) { // Ignore
* } return false; }
* @Override public String toString() { // return String.format("IP: %s \t Name: %s", hostIp, hostName); // TODO: Uses
* String.format, then returns unmodified string return String.format(hostIp); } } /** Adds new resources into
* the resource pool.
* @param r Description of the resources to add into the resource pool
* @throws AgentException could not create a configuration to start using this resource / public static void
* addResources(Resource<?, ?> r) throws AgentException { String workerName = r.getName();
* MethodResourceDescription description = r.getDescription(); DynamicMethodWorker worker =
* ResourceManager.getDynamicResource(workerName); if (worker != null) {
* ResourceManager.increasedDynamicWorker(worker, description); } else { String adaptor = r.getAdaptor();
* Map<String, Object> projectConf = new HashMap<>(); projectConf.put("Properties", r.getProjectConf());
* Map<String, Object> resourcesConf = new HashMap<>(); resourcesConf.put("Properties",
* r.getResourceConf()); registerWorker(workerName, description, adaptor, projectConf, resourcesConf); } }
* private static DynamicMethodWorker registerWorker(String workerName, MethodResourceDescription
* description, String adaptor, Map<String, Object> projectConf, Map<String, Object> resourcesConf) throws
* AgentException { System.out.println("REGISTERING NEW WORKER with adaptor " + adaptor); if (description ==
* null) { description = new MethodResourceDescription(); } MethodConfiguration mc; try { mc =
* (MethodConfiguration) Comm.constructConfiguration(adaptor, projectConf, resourcesConf); } catch
* (ConstructConfigurationException e) { throw new AgentException(e.getMessage(), e); } int limitOfTasks =
* mc.getLimitOfTasks(); int computingUnits = description.getTotalCPUComputingUnits(); if (limitOfTasks < 0
* && computingUnits < 0) { mc.setLimitOfTasks(0); mc.setTotalComputingUnits(0); } else {
* mc.setLimitOfTasks(Math.max(limitOfTasks, computingUnits));
* mc.setTotalComputingUnits(Math.max(limitOfTasks, computingUnits)); }
* mc.setLimitOfGPUTasks(description.getTotalGPUComputingUnits());
* mc.setTotalGPUComputingUnits(description.getTotalGPUComputingUnits());
* mc.setLimitOfFPGATasks(description.getTotalFPGAComputingUnits());
* mc.setTotalFPGAComputingUnits(description.getTotalFPGAComputingUnits());
* mc.setLimitOfOTHERsTasks(description.getTotalOTHERComputingUnits());
* mc.setTotalOTHERComputingUnits(description.getTotalOTHERComputingUnits()); mc.setHost(workerName);
* DynamicMethodWorker worker; worker = new DynamicMethodWorker(workerName, description, mc, new
* HashMap<>()); ResourceManager.addDynamicWorker(worker, description); return worker; }
*/
/**
* Requests the agent to stop using some resources from a node.
*
* @param workerName name of the worker to whom the resources belong.
* @param reduction description of the resources to stop using.
* @throws AgentException the worker was not set up for the agent. / public static void removeResources(String
* workerName, MethodResourceDescription reduction) throws AgentException { DynamicMethodWorker worker =
* ResourceManager.getDynamicResource(workerName); if (worker != null) {
* ResourceManager.requestWorkerReduction(worker, reduction); } else { throw new AgentException("Resource "
* + workerName + " was not set up for this agent. Ignoring request."); } } }
*/
\ No newline at end of file
......@@ -87,8 +87,8 @@ public class ResourceLoader {
private static String project_XSD;
// File instances (for cross validation)
private static ResourcesFile resources;
private static ProjectFile project;
public static ResourcesFile resources;
public static ProjectFile project;
// Logger
private static final Logger LOGGER = LogManager.getLogger(Loggers.RM_COMP);
......@@ -111,6 +111,7 @@ public class ResourceLoader {
init(resourcesXML, resourcesXSD, projectXML, projectXSD);
if ((ResourceLoader.resources_XML != null) && (ResourceLoader.project_XML != null)) {
loadFiles();
NetworkDiscovery.start(ResourceLoader.project, ResourceLoader.resources); //// LLamada a Discovery
loadRuntime();
} else {
LOGGER.warn("No resource/project file detected. Starting runtime without computing resources.");
......@@ -493,7 +494,133 @@ public class ResourceLoader {
return true;
}
private static MethodWorker createMethodWorker(String name, MethodResourceDescription rd,
static MethodWorker createMethodWorker(ComputeNodeType cnProject,
es.bsc.compss.types.resources.jaxb.ComputeNodeType cnResources) throws Exception {
// Add the name
String name = cnProject.getName();
/* Add properties given by the resources file **************************************** */
MethodResourceDescription mrd = new MethodResourceDescription();
List<es.bsc.compss.types.resources.jaxb.ProcessorType> processors = resources.getProcessors(cnResources);
if (processors != null) {
for (es.bsc.compss.types.resources.jaxb.ProcessorType p : processors) {
String procName = p.getName();
int computingUnits = resources.getProcessorComputingUnits(p);
String architecture = resources.getProcessorArchitecture(p);
float speed = resources.getProcessorSpeed(p);
String type = resources.getProcessorType(p);
float internalMemory = resources.getProcessorMemorySize(p);
es.bsc.compss.types.resources.jaxb.ProcessorPropertyType procProp = resources.getProcessorProperty(p);
String propKey = (procProp != null) ? procProp.getKey() : "";
String propValue = (procProp != null) ? procProp.getValue() : "";
mrd.addProcessor(procName, computingUnits, architecture, speed, type, internalMemory, propKey,
propValue);
}
}
mrd.setMemorySize(resources.getMemorySize(cnResources));
mrd.setMemoryType(resources.getMemoryType(cnResources));
mrd.setStorageSize(resources.getStorageSize(cnResources));
mrd.setStorageBW(resources.getStorageBW(cnResources));
mrd.setStorageType(resources.getStorageType(cnResources));
mrd.setOperatingSystemType(resources.getOperatingSystemType(cnResources));
mrd.setOperatingSystemDistribution(resources.getOperatingSystemDistribution(cnResources));
mrd.setOperatingSystemVersion(resources.getOperatingSystemVersion(cnResources));
List<String> apps = resources.getApplications(cnResources);
if (apps != null) {
for (String appName : apps) {
mrd.addApplication(appName);
}
}
es.bsc.compss.types.resources.jaxb.PriceType p = resources.getPrice(cnResources);
if (p != null) {
mrd.setPriceTimeUnit(p.getTimeUnit());
mrd.setPricePerUnit(p.getPricePerUnit());
}
// Add Shared Disks (Name, mountpoint)
Map<String, String> sharedDisks = resources.getSharedDisks(cnResources);
if (sharedDisks != null) {
List<String> declaredSharedDisks = resources.getSharedDisks_names();
for (String diskName : sharedDisks.keySet()) {
if (declaredSharedDisks == null || !declaredSharedDisks.contains(diskName)) {
ErrorManager.warn("SharedDisk " + diskName + " defined in the ComputeNode " + name
+ " is not defined in the resources.xml. Skipping");
sharedDisks.remove(diskName);
// TODO: Check the disk information (size and type)
}
}
}
// Add the adaptors properties (queue types and adaptor properties)
// TODO Support multiple adaptor properties
String loadedAdaptor = System.getProperty(COMPSsConstants.COMM_ADAPTOR);
List<String> queuesProject = project.getAdaptorQueues(cnProject, loadedAdaptor);
List<String> queuesResources = resources.getAdaptorQueues(cnResources, loadedAdaptor);
if (queuesProject == null) {
// Has no tag adaptors on project, get default resources complete
for (String queue : queuesResources) {
mrd.addHostQueue(queue);
}
} else {
// Project defines a subset of queues
for (String queue : queuesResources) {
if (queuesProject.contains(queue)) {
mrd.addHostQueue(queue);
}
}
}
MethodConfiguration config = createConfiguration(cnProject, cnResources, mrd, loadedAdaptor);
/* Pass all the information to the ResourceManager to insert it into the Runtime ** */
LOGGER.debug("Adding method worker " + name);
return ResourceLoader.createMethodWorker(name, mrd, sharedDisks, config);
}
static MethodConfiguration createConfiguration(ComputeNodeType cnProject,
es.bsc.compss.types.resources.jaxb.ComputeNodeType cnResources, MethodResourceDescription mrd,
String loadedAdaptor) throws Exception {
Map<String, Object> adaptorPropertiesProject = project.getAdaptorProperties(cnProject, loadedAdaptor);
Map<String, Object> adaptorPropertiesResources = resources.getAdaptorProperties(cnResources, loadedAdaptor);
MethodConfiguration config = null;
try {
config = (MethodConfiguration) Comm.constructConfiguration(loadedAdaptor, adaptorPropertiesProject,
adaptorPropertiesResources);
} catch (ConstructConfigurationException cce) {
ErrorManager.warn("Adaptor " + loadedAdaptor + " configuration constructor failed", cce);
throw cce;
}
// If we have reached this point the config is SURELY not null
/* Add properties given by the project file **************************************** */
config.setHost(cnProject.getName());
config.setUser(project.getUser(cnProject));
config.setInstallDir(project.getInstallDir(cnProject));
config.setWorkingDir(project.getWorkingDir(cnProject));
int limitOfTasks = project.getLimitOfTasks(cnProject);
if (limitOfTasks >= 0) {
config.setLimitOfTasks(limitOfTasks);
} else {
config.setLimitOfTasks(mrd.getTotalCPUComputingUnits());
}
config.setTotalComputingUnits(mrd.getTotalCPUComputingUnits());
config.setTotalGPUComputingUnits(mrd.getTotalGPUComputingUnits());
config.setTotalFPGAComputingUnits(mrd.getTotalFPGAComputingUnits());
config.setTotalOTHERComputingUnits(mrd.getTotalOTHERComputingUnits());
ApplicationType app = project.getApplication(cnProject);
if (app != null) {
config.setAppDir(app.getAppDir());
config.setLibraryPath(app.getLibraryPath());
config.setClasspath(app.getClasspath());
config.setPythonpath(app.getPythonpath());
}
return config;
}
public static MethodWorker createMethodWorker(String name, MethodResourceDescription rd,
Map<String, String> sharedDisks, MethodConfiguration mc) {
// Compute task count
......