コード例 #1
0
ファイル: ResourceGenerator.py プロジェクト: fonhorst/RENDLER
 def r(list_flops):
    result = []
    res = Resource("res_0")
    for flop, i in zip(list_flops, range(len(list_flops))):
        node = Node(res.name + "_node_" + str(i), res, [SoftItem.ANY_SOFT])
        node.flops = flop
        result.append(node)
    res.nodes = result
    return [res]
コード例 #2
0
 def generate_resources(list_flops):
    result = []
    for nodes_list, j in zip(list_flops, range(len(list_flops))):
        blade = []
        res = Resource("res_" + str(j))
        for flop, i in zip(nodes_list, range(len(nodes_list))):
            node = Node(res.name + "_node_" + str(i), res, [SoftItem.ANY_SOFT])
            node.flops = flop
            blade.append(node)
        res.nodes = blade
        result.append(res)
    return result
コード例 #3
0
ファイル: Utility.py プロジェクト: fonhorst/RENDLER
        def as_schedule(dct):
            if '__cls__' in dct and dct['__cls__'] == 'Node':
                res = dct['resource']
                node = Node(dct['name'], res, dct['soft'])
                node.flops = dct['flops']
                return node
            if '__cls__' in dct and dct['__cls__'] == 'ScheduleItem':
                task = task_dict[dct['job']]
                scItem = ScheduleItem(task, dct['start_time'], dct['end_time'])
                scItem.state = dct['state']
                return scItem
            if '__cls__' in dct and dct['__cls__'] == 'Schedule':
                mapping = {node_values['node']: node_values['value'] for node_values in dct['mapping']}
                schedule = Schedule(mapping)
                return schedule
            if '__cls__' in dct and dct['__cls__'] == 'Resource':
                res = Resource(dct['name'])
                res.nodes = dct['nodes']
                return res
            if '__cls__' in dct and dct['__cls__'] == 'SaveBundle':

                all_nodes = set()
                for res in dct['dedicated_resources']:
                    for node in res.nodes:
                        node.resource = res
                    all_nodes.update(res.nodes)

                all_nodes = {node.name: node for node in all_nodes}

                dct['ga_schedule'].mapping = {all_nodes[node_name]: values for (node_name, values) in
                                              dct['ga_schedule'].mapping.items()}

                bundle = SaveBundle(dct['name'],
                                    dct['dedicated_resources'],
                                    dct['transfer_mx'],
                                    dct['ideal_flops'],
                                    dct['ga_schedule'],
                                    dct['wf_name'])
                return bundle
            return dct