22import atexit
33import csv
44import heapq
5- import logging
65import math
76import os
87import shutil
@@ -126,7 +125,7 @@ def __init__(self, data_rate, packet_rate, end_time, flow_rate, flows):
126125 self .packet_rate = - packet_rate
127126 self .time = end_time
128127 self .flow_rate = - flow_rate
129- self .flows = - flows
128+ self .flows = - int ( flows )
130129
131130
132131class OnePacketFlow (Event ):
@@ -247,8 +246,10 @@ def create_event_queue(
247246
248247 # get start and end
249248 start = min (start , math .floor (chunk ["START_TIME" ].min () / 1000 ))
250- col_end = "EXPORT_TIME" if "EXPORT_TIME" in chunk .columns else "END_TIME"
251- end = max (end , math .ceil (chunk [col_end ].max () / 1000 ))
249+ if "EXPORT_TIME" in chunk .columns :
250+ end = max (end , math .ceil (chunk ["EXPORT_TIME" ].max ()))
251+ else :
252+ end = max (end , math .ceil (chunk ["END_TIME" ].max () / 1000 ))
252253
253254 # One-packet flows
254255 (
@@ -257,7 +258,7 @@ def create_event_queue(
257258 .agg (** agg_dict )
258259 .sort_values ("START_TIME" )
259260 .to_csv (
260- temp_one ,
261+ temp_one . name ,
261262 index = False ,
262263 )
263264 )
@@ -276,7 +277,7 @@ def create_event_queue(
276277 )
277278 .sort_values ("EXPORT_TIME" )
278279 .to_csv (
279- temp_export ,
280+ temp_export . name ,
280281 index = False ,
281282 )
282283 )
@@ -288,7 +289,7 @@ def create_event_queue(
288289 .agg (** agg_dict )
289290 .sort_values ("START_TIME" )
290291 .to_csv (
291- temp_start ,
292+ temp_start . name ,
292293 index = False ,
293294 )
294295 )
@@ -299,7 +300,7 @@ def create_event_queue(
299300 .agg (** agg_dict )
300301 .sort_values ("END_TIME" )
301302 .to_csv (
302- temp_end ,
303+ temp_end . name ,
303304 index = False ,
304305 )
305306 )
@@ -313,8 +314,7 @@ def create_event_queue(
313314 usecols = STATS_CSV_COLUMN_TYPES .keys (),
314315 )
315316 stats_df = stats_df [(stats_df ["Time" ] >= start ) & (stats_df ["Time" ] <= end )]
316- except Exception as e :
317- logging .error (e )
317+ except Exception :
318318 stats_df = pd .DataFrame ([], columns = STATS_CSV_COLUMN_TYPES .keys ())
319319
320320 agg_dict = {col : "sum" for col in SUM_PIDSTAT_COLS }
@@ -348,7 +348,7 @@ def read_export_events(path: os.PathLike):
348348 # It's possilble that columns weren't merged because of chunked reads
349349 # merge here where columns are iterated by EXPORT_TIME
350350 if not previous :
351- row = previous
351+ previous = row
352352 continue
353353 if (
354354 previous ["EXPORT_TIME" ] == row ["EXPORT_TIME" ]
0 commit comments