1 package at.ac.tuwien.lsdc.federation;
3 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory;
6 import at.ac.tuwien.lsdc.JobGenerator;
7 import at.ac.tuwien.lsdc.SchedSimulator;
8 import at.ac.tuwien.lsdc.sched.SchedulerB;
9 import at.ac.tuwien.lsdc.types.Application;
12 * Cloudpartners management. Class to be used to ask cloudpartners to take one
13 * of our APPs over to their infrastructure.
18 public class Federation {
22 private static final Logger LOG = LoggerFactory.getLogger(SchedulerB.class);
24 private int numPartners;
26 public Federation(int numPartners) {
27 this.numPartners = numPartners;
31 * Try to outsource app.
34 * Application to outsource.
35 * @return true, if application can be outsourced.
37 public boolean askToOutsource(Application app) {
38 LOG.info("askToOutsource():" + app);
39 if ((Math.random() * 100) < (10 * numPartners))
45 * Try to insource app.
47 * @return application to be insourced.
49 @SuppressWarnings("unused")
50 public Application askToInsource() {
51 LOG.info("askToOutsource()");
57 if ((Math.random() * 100) < (10 * numPartners) && false)
58 switch (SchedSimulator.getScenario()) {
60 size = JobGenerator.randomInt(20, 100);
61 ram = JobGenerator.randomInt(30, 50);
62 cpu = JobGenerator.randomInt(50, 100);
63 duration = JobGenerator.randomInt(1, 50);
64 return new Application(0, size, ram, cpu, duration);
66 size = JobGenerator.randomInt(150, 500);
67 ram = JobGenerator.randomInt(100, 700);
68 cpu = JobGenerator.randomInt(100, 400);
69 duration = JobGenerator.randomInt(1, 50);
70 return new Application(0, size, ram, cpu, duration);
72 size = JobGenerator.randomInt(20, 500);
73 ram = JobGenerator.randomInt(30, 700);
74 cpu = JobGenerator.randomInt(50, 400);
75 duration = JobGenerator.randomInt(1, 50);
76 return new Application(0, size, ram, cpu, duration);