From 8e63214dabc1d01e8e69a0b4713db389b62a2a58 Mon Sep 17 00:00:00 2001 From: Rakrish Dhakal <41878376+hsirkar@users.noreply.github.com> Date: Fri, 18 Oct 2024 10:18:39 -0400 Subject: [PATCH] fix flake8 and black (#125) --- pipit/readers/otf2_reader.py | 6 +++--- pipit/readers/projections_reader.py | 12 ++++++------ pipit/trace.py | 8 ++++---- pipit/util/cct.py | 8 +++++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/pipit/readers/otf2_reader.py b/pipit/readers/otf2_reader.py index b1fae889..b685c3a7 100644 --- a/pipit/readers/otf2_reader.py +++ b/pipit/readers/otf2_reader.py @@ -316,9 +316,9 @@ def events_reader(self, rank_size): if value is not None and key != "time": # uses field_to_val to convert all data types # and ensure that there are no pickling errors - attributes_dict[ - self.field_to_val(key) - ] = self.handle_data(value) + attributes_dict[self.field_to_val(key)] = ( + self.handle_data(value) + ) event_attributes.append(attributes_dict) else: # nan attributes for leave rows diff --git a/pipit/readers/projections_reader.py b/pipit/readers/projections_reader.py index 38153e8f..dd59ffe2 100644 --- a/pipit/readers/projections_reader.py +++ b/pipit/readers/projections_reader.py @@ -513,10 +513,10 @@ def _read_log_file(self, rank_size) -> pd.DataFrame: pe = int(line_arr[5]) msglen = int(line_arr[6]) send_time = int(line_arr[7]) * 1000 - numPEs = int(line_arr[8]) - destPEs = [] - for i in (0, numPEs): - destPEs.append(int(line_arr[9 + i])) + num_procs = int(line_arr[8]) + dest_procs = [] + for i in (0, num_procs): + dest_procs.append(int(line_arr[9 + i])) details = { "From PE": pe, @@ -525,7 +525,7 @@ def _read_log_file(self, rank_size) -> pd.DataFrame: "Message Length": msglen, "Event ID": event, "Send Time": send_time, - "Destinatopn PEs": destPEs, + "Destinatopn PEs": dest_procs, } _add_to_trace_dict( @@ -534,7 +534,7 @@ def _read_log_file(self, rank_size) -> pd.DataFrame: "Instant", time, pe_num, - "To " + str(numPEs) + "processors", + "To " + str(num_procs) + "processors", ) # Processing of chare (i.e. execution) ? diff --git a/pipit/trace.py b/pipit/trace.py index 2b4f111a..fcc9f75d 100644 --- a/pipit/trace.py +++ b/pipit/trace.py @@ -597,7 +597,7 @@ def load_imbalance(self, metric="time.exc", num_processes=1): return imbalance_df - def idle_time(self, idle_functions=["Idle"], MPI_events=False): + def idle_time(self, idle_functions=["Idle"], mpi_events=False): # dict for creating a new dataframe idle_times = {"Process": [], "Idle Time": []} @@ -605,19 +605,19 @@ def idle_time(self, idle_functions=["Idle"], MPI_events=False): idle_times["Process"].append(process) idle_times["Idle Time"].append( self._calculate_idle_time_for_process( - process, idle_functions, MPI_events + process, idle_functions, mpi_events ) ) return pd.DataFrame(idle_times) def _calculate_idle_time_for_process( - self, process, idle_functions=["Idle"], MPI_events=False + self, process, idle_functions=["Idle"], mpi_events=False ): # calculate inclusive metrics if "time.inc" not in self.events.columns: self.calc_inc_metrics() - if MPI_events: + if mpi_events: idle_functions += ["MPI_Wait", "MPI_Waitall", "MPI_Recv"] # filter the dataframe to include only 'Enter' events within the specified # process with the specified function names diff --git a/pipit/util/cct.py b/pipit/util/cct.py index 6557a588..b4992271 100644 --- a/pipit/util/cct.py +++ b/pipit/util/cct.py @@ -86,9 +86,11 @@ def create_cct(events): # add node as root or child of its # parent depending on current depth - graph.add_root( - curr_node - ) if curr_depth == 0 else parent_node.add_child(curr_node) + ( + graph.add_root(curr_node) + if curr_depth == 0 + else parent_node.add_child(curr_node) + ) # Update nodes stack, column, and current depth nodes_stack.append(curr_node)