use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class CoreManager method debugString.
/*
* *****************************************************************************************************
* *****************************************************************************************************
* ************** DEBUG OPERATIONS *********************************************************************
* *****************************************************************************************************
* *****************************************************************************************************
*/
public static String debugString() {
StringBuilder sb = new StringBuilder();
sb.append("Core Count: ").append(coreCount).append("\n");
for (int coreId = 0; coreId < coreCount; coreId++) {
sb.append("\tCore ").append(coreId).append(":\n");
for (Implementation impl : IMPLEMENTATIONS.get(coreId)) {
sb.append("\t\t -").append(impl.toString()).append("\n");
}
}
return sb.toString();
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class Test method cloudManagerTest.
/*
* *********************************** CLOUD MANAGER TEST IMPLEMENTATION ***********************************
*/
private static void cloudManagerTest() {
// Print Out CloudManager static structures
System.out.println("[LOG] CloudManager Static Structures definition");
// Check for each implementation the correctness of its resources
coreCount = CoreManager.getCoreCount();
CloudProvider cp = ResourceManager.getCloudProvider("BSC");
for (int coreId = 0; coreId < coreCount; coreId++) {
System.out.println("[LOG] Checking Core" + coreId);
for (Implementation impl : CoreManager.getCoreImplementations(coreId)) {
if (impl.getTaskType().equals(TaskType.METHOD)) {
System.out.println("[LOG]\t Checking Implementation: " + impl.getImplementationId());
System.out.println("\t\t Checking obtained compatible cloud images");
MethodImplementation mImpl = (MethodImplementation) impl;
for (CloudImageDescription cid_gci : cp.getCompatibleImages(mImpl.getRequirements())) {
System.out.println("\t\t\t Checking compatible Image: " + cid_gci.getImageName());
String res = checkImplementationAssignedToCloudImage(mImpl.getRequirements(), cid_gci);
if (res != null) {
String error = "[ERROR] Implementation: Core = " + coreId + " Impl = " + impl.getImplementationId() + ". ";
error = error.concat("Implementation and cloud image not matching on: " + res);
System.out.println(error);
System.exit(-1);
}
}
System.out.println("\t\t Checking obtained compatible cloud types");
for (CloudInstanceTypeDescription type : cp.getCompatibleTypes(new CloudMethodResourceDescription(mImpl.getRequirements()))) {
if (type.getResourceDescription().canHostSimultaneously(mImpl.getRequirements()) < 1) {
continue;
}
System.out.println("\t\t\t Checking compatible Type: " + type.getName());
String res = checkImplementationAssignedToType(mImpl.getRequirements(), type.getResourceDescription());
if (res != null) {
String error = "[ERROR] Implementation: Core = " + coreId + " Impl = " + impl.getImplementationId() + ". ";
error = error.concat("Implementation and type not matching on: " + res);
System.out.println(error);
System.exit(-1);
}
}
}
}
}
// Return success value
System.out.println("[LOG] * CloudManager test passed");
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class Action method findAvailableWorkers.
@SuppressWarnings("unchecked")
public Map<Worker<?>, List<Implementation>> findAvailableWorkers() {
Map<Worker<?>, List<Implementation>> m = new HashMap<>();
List<ResourceScheduler<? extends WorkerResourceDescription>> compatibleWorkers = getCoreElementExecutors(coreId);
for (ResourceScheduler<? extends WorkerResourceDescription> ui : compatibleWorkers) {
Worker<WorkerResourceDescription> r = (Worker<WorkerResourceDescription>) ui.getResource();
List<Implementation> compatibleImpls = r.getExecutableImpls(coreId);
List<Implementation> runnableImpls = new LinkedList<>();
for (Implementation impl : compatibleImpls) {
if (r.canRunNow(impl.getRequirements())) {
runnableImpls.add(impl);
}
}
if (runnableImpls.size() > 0) {
m.put((Worker<?>) r, runnableImpls);
}
}
return m;
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class Test method checkCoreElementConstraints.
private static void checkCoreElementConstraints(int coreId) {
System.out.println("[LOG] Checking " + coreToName[coreId]);
System.out.println("[LOG] \t Has " + declaringClassesItf[coreId].length + " declaring classes in the CEI");
System.out.println("[LOG] \t Has " + idToSignatures[coreId].size() + " signatures registered");
// Signatures store one dummy extra signature
if (declaringClassesItf[coreId].length + 1 != idToSignatures[coreId].size()) {
System.out.println(coreToName[coreId] + " has " + idToSignatures[coreId].size() + " registered signatures and there are " + declaringClassesItf[coreId].length + " declaringClasses in the CEI");
System.exit(-1);
}
List<Implementation> implementations = CoreManager.getCoreImplementations(coreId);
System.out.println("[LOG] \t Has " + implementations.size() + " implementations registered");
if (declaringClassesItf[coreId].length != implementations.size()) {
System.out.println(coreToName[coreId] + " has " + implementations.size() + " registered implementations and there are " + declaringClassesItf[coreId].length + " declaringClasses in the CEI");
System.exit(-1);
}
// Check all constraints
for (int implId = 0; implId < declaringClassesItf[coreId].length; implId++) {
MethodImplementation m = ((MethodImplementation) implementations.get(implId));
System.out.println("[LOG] \t" + declaringClassesItf[coreId][implId]);
if (declaringClassesItf[coreId][implId].compareTo(m.getDeclaringClass()) != 0) {
System.out.println(coreToName[coreId] + "'s declaringClass " + declaringClassesItf[coreId][implId] + " is not included registered in the system");
System.exit(-1);
}
String constraint = checkConstraints(generalConstraintsItf[coreId], constraintsItf[coreId][implId], m.getRequirements());
if (constraint != null) {
System.out.println("Constraints for " + coreToName[coreId] + "'s declaringClass " + declaringClassesItf[coreId][implId] + " does not meet the annotations (" + constraint + ")");
System.exit(-1);
}
}
}
use of es.bsc.compss.types.implementations.Implementation in project compss by bsc-wdc.
the class TestCompatible method checkCoreResources.
private static void checkCoreResources(int coreId, Map<Worker<?>, List<Implementation>> hm) {
// Revert Map
Map<Implementation, List<Worker<?>>> hm_reverted = new HashMap<>();
for (Entry<Worker<?>, List<Implementation>> entry_hm : hm.entrySet()) {
for (Implementation impl : entry_hm.getValue()) {
List<Worker<?>> aux = hm_reverted.get(impl);
if (aux == null) {
aux = new LinkedList<Worker<?>>();
}
aux.add(entry_hm.getKey());
hm_reverted.put(impl, aux);
}
}
// Check Resources assigned to each implementation
for (Entry<Implementation, List<Worker<?>>> entry : hm_reverted.entrySet()) {
System.out.println("[LOG] ** Checking Implementation " + entry.getKey());
System.out.println("[LOG] **** Number of resources = " + entry.getValue().size());
for (Worker<?> resource : entry.getValue()) {
System.out.println("[LOG] **** Checking Resource " + resource.getName());
String res = checkResourcesAssignedToImpl(entry.getKey(), resource);
if (res != null) {
String error = "Implementation: Core " + coreId + " Impl " + entry.getKey().getImplementationId() + " and Resource " + resource.getName() + ". ";
error = error.concat("Implementation and resource not matching on: " + res);
System.out.println(error);
System.exit(-1);
}
}
}
}
Aggregations