示例#1
0
 def test_fill_lg(self):
     params = {
         'param1': 1,
         'param2': '2',
         'param1.param2': True,
         'param4': {
             'what': 'hi'
         }
     }
     with open(os.path.join(lg_dir, 'cont_img.json')) as f:
         lg = pg_generator.fill(json.load(f), params)
     for node_idx, value in zip((6, 13, 35, 41), ('1', '2', 'True', 'hi')):
         node = lg['nodeDataArray'][node_idx]
         found = None
         for field in node['fields']:
             if field['name'] == 'arg10':
                 found = field['value']
         self.assertEqual(found, value)
示例#2
0
 def test_fill_lg(self):
     params = {
         "param1": 1,
         "param2": "2",
         "param1.param2": True,
         "param4": {
             "what": "hi"
         },
     }
     with open(os.path.join(lg_dir, "cont_img.graph")) as f:
         lg = pg_generator.fill(json.load(f), params)
     for node_idx, value in zip((5, 12, 26, 34), ("1", "2", "True", "hi")):
         print(node_idx)
         node = lg["nodeDataArray"][node_idx]
         found = None
         for field in node["fields"]:
             if field["name"] == "arg10":
                 found = field["value"]
         self.assertEqual(found, value)
示例#3
0
def _create_pg(logical_graph, processing_block, node_managers,
               data_island_manager, zero_cost_run):

    logical_graph = pg_generator.fill(logical_graph,
                                      processing_block.parameters)

    unroll_kwargs = {}
    if zero_cost_run:
        unroll_kwargs['zerorun'] = True
        unroll_kwargs['app'] = 'dlg.apps.simple.SleepApp'
    physical_graph_template = pg_generator.unroll(logical_graph,
                                                  **unroll_kwargs)
    physical_graph = pg_generator.partition(physical_graph_template,
                                            'mysarkar',
                                            num_partitions=len(node_managers),
                                            num_islands=1)
    physical_graph = pg_generator.resource_map(
        physical_graph, [data_island_manager] + node_managers, num_islands=1)
    return physical_graph