示例#1
0
    def __init__(self, workflow, resource_manager, estimator):

        self.counter = 0
        self.workflow = workflow

        ##interface Estimator

        self.estimator = estimator
        self.resource_manager = resource_manager

        nodes = resource_manager.get_nodes(
        )  #list(HeftHelper.to_nodes(resource_manager.get_resources()))
        ranking = HeftHelper.build_ranking_func(
            nodes, lambda job, agent: estimator.estimate_runtime(job, agent),
            lambda ni, nj, A, B: estimator.estimate_transfer_time(
                A, B, ni, nj))
        sorted_tasks = ranking(self.workflow)

        self.nodes = nodes
        self.sorted_tasks = sorted_tasks
        self.workflow_size = len(sorted_tasks)

        self.task_map = {task.id: task for task in sorted_tasks}
        self.node_map = {node.name: node for node in nodes}

        self.initializing_alg = SimpleRandomizedHeuristic(
            self.workflow, self.nodes, self.estimator)

        self.initial_chromosome = None  ##GAFunctions.schedule_to_chromosome(initial_schedule)
        pass
示例#2
0
 def make_ranking(self, wf, nodes):
     ##resources = self.resource_manager.get_resources()
     ##print("common nodes count:" + str(len(toNodes(resources))))
     ##nodes = HeftHelper.to_nodes(resources)
     ranking_func = HeftHelper.build_ranking_func(nodes, self.compcost,
                                                  self.commcost)
     wf_jobs = ranking_func(wf)
     return wf_jobs