@@ -307,7 +307,7 @@ def draw_nodes(start, nodes_list, cores, minute_scale, space_between_minutes, co
307
307
"offset" : offset ,
308
308
"scale_duration" : scale_duration ,
309
309
"color" : color ,
310
- "node_name" : node [ "name" ] ,
310
+ "node_name" : node . get ( "name" , node . get ( "id" , "" )) ,
311
311
"node_dur" : node ["duration" ] / 60.0 ,
312
312
"node_start" : node_start .strftime ("%Y-%m-%d %H:%M:%S" ),
313
313
"node_finish" : node_finish .strftime ("%Y-%m-%d %H:%M:%S" ),
@@ -527,6 +527,20 @@ def generate_gantt_chart(
527
527
# Read in json-log to get list of node dicts
528
528
nodes_list = log_to_dict (logfile )
529
529
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
+
530
544
# Create the header of the report with useful information
531
545
start_node = nodes_list [0 ]
532
546
last_node = nodes_list [- 1 ]
0 commit comments