def __init__(self, size=100, load=1.0, regions=(4,4), coords=(100,100), run_times=6, arrival_dist = dists.expon, resource_sizes = dists.gamma(100, 10), job_sizes = dists.gamma(20, 4), job_durations = dists.gamma(100, 10), service_means = dists.normal(0.1), service_dist = dists.shaped_gamma(0.1), latency_means = dists.normal(0.1), latency_dist = dists.shaped_gamma(0.1), regional_latency = dists.gamma(0.2, 0.1), global_latency = dists.gamma(0.4, 0.1) ): # calculated results self.runtime = run_times * job_durations.mean total_capacity = size * resource_sizes.mean; max_jobs = total_capacity / float(job_sizes.mean); arrival_mean = job_durations.mean / float(max_jobs); self.inter_arrival_time = arrival_dist(arrival_mean / load) self.job_sizes = job_sizes self.job_durations = job_durations # store for stats self.size = size self.load = load # generate network self.graph = network.Network( coords, regions, latency_means, regional_latency, global_latency, latency_dist) # generate nodes, but no topology network.generate_nodes(self.graph, size) self.service_dist = service_dist self.service_means = service_means for node in self.graph.nodes_iter(): node.server = Server(node, service_dist(service_means())) node.resource = GridResource(node, int(resource_sizes())) self.mons = OrderedDict() self.mons["grid_util"] = Monitor("grid_util") self.mons["server_util"] = Monitor("server_util") self.mons["server_queue"] = Monitor("server_queue")
def __init__(self, registry_type=Registry, broker_means=dists.normal(0.05), **kw): super(MdsModel, self).__init__(**kw) regions = self.graph.regions self.regions = [i for i in range(regions[0]*regions[1])] self.brokers = dict() for r in self.regions: node = self.random_region_node(r) node.server.service_time = self.service_dist(broker_means()) broker = Broker( r, node, registry_type(), 60, self.brokers) # give them an intitial picture of the grid for node in self.graph.nodes_in_region(r): state = ResourceState(node.resource_agent, node.resource.free) broker.registry.update_state(state) self.brokers[r] = broker for node in self.graph.nodes_iter(): node.broker = self.brokers[node.region] # this nodes resource agent node.resource_agent = MdsResourceAgent(node, 30) # mapping of jobagents at this node # make a link to fast comms to the broker self.graph.make_link(node, node.broker.node) # ensure brokers have fast links to each other for i, broker in enumerate(self.brokers.itervalues()): for other in self.brokers.values()[i:]: self.graph.make_link(broker.node, other.node) self.mons["broker_util"] = Monitor("broker_util") self.mons["broker_queue"] = Monitor("broker_queue")
def __init__(self, registry_type=Registry, broker_means=dists.normal(0.05), **kw): super(MdsModel, self).__init__(**kw) regions = self.graph.regions self.regions = [i for i in range(regions[0] * regions[1])] self.brokers = dict() for r in self.regions: node = self.random_region_node(r) node.server.service_time = self.service_dist(broker_means()) broker = Broker(r, node, registry_type(), 60, self.brokers) # give them an intitial picture of the grid for node in self.graph.nodes_in_region(r): state = ResourceState(node.resource_agent, node.resource.free) broker.registry.update_state(state) self.brokers[r] = broker for node in self.graph.nodes_iter(): node.broker = self.brokers[node.region] # this nodes resource agent node.resource_agent = MdsResourceAgent(node, 30) # mapping of jobagents at this node # make a link to fast comms to the broker self.graph.make_link(node, node.broker.node) # ensure brokers have fast links to each other for i, broker in enumerate(self.brokers.itervalues()): for other in self.brokers.values()[i:]: self.graph.make_link(broker.node, other.node) self.mons["broker_util"] = Monitor("broker_util") self.mons["broker_queue"] = Monitor("broker_queue")