Example #1
0
    def run(self, current_cleaned_schedule):
        ## current_cleaned_schedule - this schedule contains only
        ## finished and executed tasks, all unfinished and failed have been removed already
        ## current_cleaned_schedule also have down nodes and new added
        ## ALGORITHM DOESN'T CHECK ADDING OF NEW NODES BY ITSELF
        ## nodes contain only available now

        ## 1. get all unscheduled tasks
        ## 2. sort them by rank
        ## 3. map on the existed nodes according to current_cleaned_schedule

        nodes = self.get_nodes()
        live_nodes = [node for node in nodes if node.state != Node.Down]

        for_planning = HeftHelper.get_tasks_for_planning(self.workflow, current_cleaned_schedule)
        ## TODO: check if it sorted properly
        for_planning = set([task.id for task in for_planning])

        self.wf_jobs = self.make_ranking(self.workflow, live_nodes) if self.ranking is None else self.ranking

        sorted_tasks = [task for task in self.wf_jobs if task.id in for_planning]

        # print("P: " + str(sorted_tasks))

        new_sched = self.mapping([(self.workflow, sorted_tasks)], current_cleaned_schedule.mapping, nodes, self.commcost, self.compcost)
        return new_sched
Example #2
0
    def run(self, current_cleaned_schedule):

        nodes = self.get_nodes()
        live_nodes = [node for node in nodes if node.state != Node.Down]

        for_planning = HeftHelper.get_tasks_for_planning(self.workflow, current_cleaned_schedule)
        for_planning = set([task.id for task in for_planning])

        self.wf_jobs = self.make_ranking(self.workflow, live_nodes) if self.ranking is None else self.ranking

        sorted_tasks = [task for task in self.wf_jobs if task.id in for_planning]

        # print("P: " + str(sorted_tasks))

        new_sched = self.mapping([(self.workflow, sorted_tasks)], current_cleaned_schedule.mapping, nodes, self.commcost, self.compcost)
        return new_sched