@@ -25,6 +25,7 @@ def parse_arguments():
25
25
parser .add_argument ('--output' , type = str , default = 'topN.uno.h5' ,
26
26
help = 'output filename' )
27
27
parser .add_argument ('--show' , action = 'store_true' , help = 'Simply show the plan node' )
28
+ parser .add_argument ('--raw' , action = 'store_true' , help = 'With --show, also show raw JSON' )
28
29
29
30
args , unparsed = parser .parse_known_args ()
30
31
return args , unparsed
@@ -319,21 +320,34 @@ def show_list(L):
319
320
print_line (line )
320
321
print ("" )
321
322
323
+ def show_node (subtree ):
324
+ """Write out the given plan subtree"""
325
+ for partition in ["val" , "train" ]:
326
+ partition_sets = len (subtree [partition ])
327
+ print ("%s_sets: %i" % (partition , partition_sets ))
328
+ for index in range (0 , len (subtree [partition ])):
329
+ print ("index: %i" % index )
330
+ dataset = subtree [partition ][index ]
331
+ for key in ["CELL" , "DRUG" ]:
332
+ if key not in dataset :
333
+ continue
334
+ partition_keys = dataset [key ]
335
+ print ("%s %ss: count: %i" %
336
+ (partition , key , len (partition_keys )))
337
+ show_list (partition_keys )
338
+
322
339
323
340
def show (args ):
324
341
"""Simply show the entry for this node"""
325
342
if args .node is None :
326
343
print ("Provide a node to show!" )
327
344
exit (1 )
328
- plan_dict = read_plan (args .plan , args .node )
329
- # print(str(plan_dict))
330
- val_cells = plan_dict ['val' ][0 ]['cell' ]
331
- print ("val cells: count: %i" % len (val_cells ))
332
- show_list (val_cells )
333
- train_cells = plan_dict ['train' ][0 ]['cell' ]
334
- print ("train cells: count: %i" % len (train_cells ))
335
- show_list (train_cells )
336
-
345
+ # Get the plan subtree for the given node
346
+ subtree = read_plan (args .plan , args .node )
347
+ if args .raw :
348
+ print (str (subtree ))
349
+ print ("node: " + args .node )
350
+ show_node (subtree )
337
351
338
352
if __name__ == '__main__' :
339
353
parsed , unparsed = parse_arguments ()
0 commit comments