@@ -307,7 +307,7 @@ def draw_nodes(start, nodes_list, cores, minute_scale, space_between_minutes, co
307307 "offset" : offset ,
308308 "scale_duration" : scale_duration ,
309309 "color" : color ,
310- "node_name" : node [ "name" ] ,
310+ "node_name" : node . get ( "name" , node . get ( "id" , "" )) ,
311311 "node_dur" : node ["duration" ] / 60.0 ,
312312 "node_start" : node_start .strftime ("%Y-%m-%d %H:%M:%S" ),
313313 "node_finish" : node_finish .strftime ("%Y-%m-%d %H:%M:%S" ),
@@ -527,6 +527,20 @@ def generate_gantt_chart(
527527 # Read in json-log to get list of node dicts
528528 nodes_list = log_to_dict (logfile )
529529
530+ # Only include nodes with timing information, and covert timestamps
531+ # from strings to datetimes
532+ nodes_list = [{
533+ k : datetime .datetime .strptime (
534+ i [k ], "%Y-%m-%dT%H:%M:%S.%f"
535+ ) if k in {"start" , "finish" } else i [k ] for k in i
536+ } for i in nodes_list if "start" in i and "finish" in i ]
537+
538+ for node in nodes_list :
539+ if "duration" not in node :
540+ node ["duration" ] = (
541+ node ["finish" ] - node ["start" ]
542+ ).total_seconds ()
543+
530544 # Create the header of the report with useful information
531545 start_node = nodes_list [0 ]
532546 last_node = nodes_list [- 1 ]
0 commit comments