def default_fixed_schedule_part(resource_manager): fix_schedule_part = Schedule({ node: [] for node in HeftHelper.to_nodes( resource_manager.get_resources()) }) return fix_schedule_part
def schedule(self): """ create inter-priority """ def byPriority(wf): return 0 if wf.priority is None else wf.priority ##simple inter priority sorting sorted_wfs = sorted(self.workflows, key=byPriority) wf_jobs = {wf: [] for wf in sorted_wfs} resources = self.resource_manager.get_resources() ##print("common nodes count:" + str(len(toNodes(resources)))) nodes = HeftHelper.to_nodes(resources) wf_jobs = {wf: self.make_ranking(wf, nodes) for wf in sorted_wfs} ##new_schedule = self.get_unchanged_schedule(self.old_schedule, time) new_schedule = Schedule({node: [] for node in nodes}) new_plan = new_schedule.mapping for (wf, jobs) in wf_jobs.items(): new_schedule = self.mapping([(wf, jobs)], new_plan, nodes, self.commcost, self.compcost) new_plan = new_schedule.mapping return new_schedule
def checkDown(self, node_name, is_down): nodes = HeftHelper.to_nodes(self.public_resources) for nd in nodes: if nd.name == node_name: if is_down: nd.state = Node.Down else: nd.state = Node.Unknown pass
def get_by_softreq(self, soft_reqs): nodes = HeftHelper.to_nodes(self.public_resources) def check_reqs(node): return (soft_reqs in node.soft) or (SoftItem.ANY_SOFT in node.soft) gotcha = [ node for node in nodes if node.state != Node.Down and check_reqs(node) ] return gotcha
def _run_heft(): dynamic_planner = DynamicHeft(wf, resource_manager, estimator) nodes = HeftHelper.to_nodes(resource_manager.resources) current_cleaned_schedule = Schedule({node: [] for node in nodes}) schedule_dynamic_heft = dynamic_planner.run( current_cleaned_schedule) self._validate(wf, estimator, schedule_dynamic_heft) if is_visualized: viz.visualize_task_node_mapping(wf, schedule_dynamic_heft) # Utility.create_jedule_visualization(schedule_dynamic_heft, wf_name+'_heft') pass return schedule_dynamic_heft
def __init__( self, workflow, resource_manager, estimator, task_map, node_map, # fixed part of schedule. It need to be accounted when new schedule is built, but it's not possible to cahnge something inside it fixed_schedule_part): self.workflow = workflow self.nodes = HeftHelper.to_nodes(resource_manager.get_resources()) self.estimator = estimator ##TODO: Build it self.task_map = task_map ##TODO: Build it self.node_map = node_map self.fixed_schedule_part = fixed_schedule_part # construct initial mapping # eliminate all already scheduled tasks pass
def isCloudNode(self, node): result = node.name in [ nd.name for nd in HeftHelper.to_nodes(self.public_resources) ] return result
def get_nodes(self): resources = self.resource_manager.get_resources() nodes = HeftHelper.to_nodes(resources) return nodes