Search in sources :

Example 6 with MethodResourceDescription

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

the class ResourceSchedulerTest method testMethodB.

@Test
public void testMethodB() {
    ResourceScheduler<MethodResourceDescription> rs = new ResourceScheduler<>(worker, new JSONObject("{\"implementations\":{\"ClassA.methodB\":" + SET_PROFILE + "}}"), null);
    List<Implementation> impls = CoreManager.getCoreImplementations(0);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        try {
            checkUnsetProfile(p);
        } catch (CheckerException ce) {
            fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodB test");
        }
    }
    impls = CoreManager.getCoreImplementations(1);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        try {
            checkSetProfile(p);
        } catch (CheckerException ce) {
            fail("Invalid " + ce.getFeature() + " for set implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodB test");
        }
    }
}
Also used : JSONObject(org.json.JSONObject) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) Test(org.junit.Test)

Example 7 with MethodResourceDescription

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

the class ResourceSchedulerTest method testMethodASetNull.

@Test
public void testMethodASetNull() {
    ResourceScheduler<MethodResourceDescription> rs = new ResourceScheduler<>(worker, new JSONObject("{\"implementations\":{\"ClassA.methodA\":" + SET_PROFILE + "}}"), null);
    List<Implementation> impls = CoreManager.getCoreImplementations(0);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        if (impl.getImplementationId() == 1) {
            try {
                checkUnsetProfile(p);
            } catch (CheckerException ce) {
                fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA set-null test");
            }
        } else {
            try {
                checkSetProfile(p);
            } catch (CheckerException ce) {
                fail("Invalid " + ce.getFeature() + " for set implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA set-null test");
            }
        }
    }
    impls = CoreManager.getCoreImplementations(1);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        try {
            checkUnsetProfile(p);
        } catch (CheckerException ce) {
            fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA set-null test");
        }
    }
}
Also used : JSONObject(org.json.JSONObject) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) Test(org.junit.Test)

Example 8 with MethodResourceDescription

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

the class ResourceSchedulerTest method testMethodAUpdatedNull.

@Test
public void testMethodAUpdatedNull() {
    ResourceScheduler<MethodResourceDescription> rs = new ResourceScheduler<>(worker, new JSONObject("{\"implementations\":{\"ClassA.methodA\":" + SET_AND_UPDATED_PROFILE + "}}"), null);
    List<Implementation> impls = CoreManager.getCoreImplementations(0);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        if (impl.getImplementationId() == 1) {
            try {
                checkUnsetProfile(p);
            } catch (CheckerException ce) {
                fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA updated-null test");
            }
        } else {
            try {
                this.checkSetAndIncreasedProfile(p);
            } catch (CheckerException ce) {
                fail("Invalid " + ce.getFeature() + " for set implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA updated-null test");
            }
        }
    }
    impls = CoreManager.getCoreImplementations(1);
    for (Implementation impl : impls) {
        Profile p = rs.getProfile(impl);
        try {
            checkUnsetProfile(p);
        } catch (CheckerException ce) {
            fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on MethodA updated-null test");
        }
    }
}
Also used : JSONObject(org.json.JSONObject) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) ResourceScheduler(es.bsc.compss.components.impl.ResourceScheduler) Implementation(es.bsc.compss.types.implementations.Implementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) Test(org.junit.Test)

Example 9 with MethodResourceDescription

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

the class AllocatableActionTest method setUpClass.

@BeforeClass
public static void setUpClass() {
    ResourceManager.clear(rus);
    // Method resource description and its slots
    int maxSlots = 3;
    Processor p = new Processor();
    p.setComputingUnits(maxSlots);
    description = new MethodResourceDescription();
    description.addProcessor(p);
    // Task Scheduler
    ts = new TaskScheduler();
    // Task Dispatcher
    fao = new FakeActionOrchestrator(ts);
    ts.setOrchestrator(fao);
    // Resource Scheduler
    rs = new FakeResourceScheduler(new FakeWorker(description, maxSlots), null, null);
}
Also used : FakeActionOrchestrator(es.bsc.compss.types.fake.FakeActionOrchestrator) Processor(es.bsc.compss.types.resources.components.Processor) FakeResourceScheduler(es.bsc.compss.types.fake.FakeResourceScheduler) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) TaskScheduler(es.bsc.compss.components.impl.TaskScheduler) FakeWorker(es.bsc.compss.types.fake.FakeWorker) BeforeClass(org.junit.BeforeClass)

Example 10 with MethodResourceDescription

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

the class MOResourceSchedulerTest method testAllSetCopy.

@Test
public void testAllSetCopy() {
    MOResourceScheduler<MethodResourceDescription> rs = new MOResourceScheduler<MethodResourceDescription>(worker, new JSONObject("{\"idlePower\": " + SET_IDLE_POWER + ", \"idlePrice\": " + SET_IDLE_PRICE + ", \"implementations\":{\"ClassA.methodA\":" + SET_PROFILE + "," + "\"ClassB.methodA\":" + SET_PROFILE + "," + "\"ClassA.methodB\":" + SET_PROFILE + "}}"), null);
    JSONObject jo = rs.toJSONObject();
    rs = new MOResourceScheduler<MethodResourceDescription>(worker, jo, null);
    for (int coreId = 0; coreId < CoreManager.getCoreCount(); coreId++) {
        List<Implementation> impls = CoreManager.getCoreImplementations(coreId);
        for (Implementation impl : impls) {
            MOProfile p = (MOProfile) rs.getProfile(impl);
            try {
                checkSetProfile(p);
            } catch (CheckerException ce) {
                fail("Invalid " + ce.getFeature() + " for unset implementation " + impl.getImplementationId() + " core " + impl.getCoreId() + " on all set test");
            }
        }
    }
    if (rs.getIdlePower() != SET_IDLE_POWER) {
        fail("Invalid idle Power for copy test");
    }
    if (rs.getIdlePrice() != SET_IDLE_PRICE) {
        fail("Invalid idle Price for copy test");
    }
}
Also used : MOResourceScheduler(es.bsc.compss.scheduler.multiobjective.MOResourceScheduler) JSONObject(org.json.JSONObject) MethodResourceDescription(es.bsc.compss.types.resources.MethodResourceDescription) Implementation(es.bsc.compss.types.implementations.Implementation) MethodImplementation(es.bsc.compss.types.implementations.MethodImplementation) MOProfile(es.bsc.compss.scheduler.multiobjective.types.MOProfile) Test(org.junit.Test)

Aggregations

MethodResourceDescription (es.bsc.compss.types.resources.MethodResourceDescription)51 CloudMethodResourceDescription (es.bsc.compss.types.resources.description.CloudMethodResourceDescription)26 Test (org.junit.Test)23 CloudInstanceTypeDescription (es.bsc.compss.types.resources.description.CloudInstanceTypeDescription)21 Implementation (es.bsc.compss.types.implementations.Implementation)20 MethodImplementation (es.bsc.compss.types.implementations.MethodImplementation)19 HashMap (java.util.HashMap)17 CloudImageDescription (es.bsc.compss.types.resources.description.CloudImageDescription)12 JSONObject (org.json.JSONObject)10 ResourceScheduler (es.bsc.compss.components.impl.ResourceScheduler)9 FakeNode (es.bsc.compss.types.fake.FakeNode)7 CloudMethodWorker (es.bsc.compss.types.resources.CloudMethodWorker)7 MOProfile (es.bsc.compss.scheduler.multiobjective.types.MOProfile)4 CloudProvider (es.bsc.compss.types.CloudProvider)4 Processor (es.bsc.compss.types.resources.components.Processor)4 MethodWorker (es.bsc.compss.types.resources.MethodWorker)3 LinkedList (java.util.LinkedList)3 ResourceCreationRequest (es.bsc.compss.types.ResourceCreationRequest)2 FakeWorker (es.bsc.compss.types.fake.FakeWorker)2 AbstractMethodImplementation (es.bsc.compss.types.implementations.AbstractMethodImplementation)2