Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#573: verified that no bug is actually present but made stylistic changes #580

Merged
merged 2 commits into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/lbaf/IO/lbsVTDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from ..Model.lbsObjectCommunicator import ObjectCommunicator
from ..Model.lbsRank import Rank

class LoadReader:

Check notice on line 58 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many instance attributes (9/7) (too-many-instance-attributes)
"""A class to read VT Object Map files. These json files could be compressed with Brotli.

Each file is named as <base-name>.<node>.json, where <node> spans the number of MPI ranks that VT is utilizing.
Expand Down Expand Up @@ -134,9 +134,9 @@

def _get_n_ranks(self):
"""Determine the number of ranks automatically.

This use the first applicable method in the following methods:
List all data file names matching {file_prefix}.{rank_id}.{file_suffix} pattern and return max(rank_id) + 1.
This uses the first applicable method in the following methods:
List all data file names matching {file_prefix}.{rank_id}.{file_suffix}
pattern and return max(rank_id) + 1.
"""

# or default detect data files with pattern
Expand Down Expand Up @@ -199,7 +199,7 @@
# Return rank ID and data dictionary
return rank_id, decompressed_dict

def _populate_rank(self, phase_id: int, rank_id: int) -> Tuple[Rank,dict]:

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many local variables (38/15) (too-many-locals)

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many branches (18/12) (too-many-branches)

Check notice on line 202 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many statements (63/50) (too-many-statements)
""" Populate rank and its communicator in phase using the JSON content."""

# Seek phase with given ID
Expand All @@ -224,9 +224,9 @@
self.__logger.debug(
f"Loading phase {curr_phase_id} for rank {rank_id}")

# Add communications to the object
# Add communications when available
rank_comm = {}
if (communications := phase.get("communications")): # pylint:disable=W0631:undefined-loop-variable
if (communications := phase.get("communications")):

Check warning on line 229 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Using possibly undefined loop variable 'phase' (undefined-loop-variable)
if phase_id in self.__communications_dict:
self.__communications_dict[phase_id][rank_id] = communications
else:
Expand Down Expand Up @@ -263,6 +263,7 @@
for k, v in comm.items():
self.__logger.debug(f"{k}: {v}")
else:
# No communications for this phase
self.__communications_dict.setdefault(phase_id, {rank_id: {}})

# Instantiante rank for current phase
Expand All @@ -273,11 +274,11 @@
rank_blocks, task_user_defined = {}, {}

# Iterate over tasks
for task in phase.get("tasks", []): # pylint:disable=W0631:undefined-loop-variable
for task in phase.get("tasks", []):

Check warning on line 277 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Using possibly undefined loop variable 'phase' (undefined-loop-variable)
# Retrieve required values
task_entity = task.get("entity")
task_id = task_entity.get("id", None)
task_seq_id = task_entity.get("seq_id", None)
task_id = task_entity.get("id")
task_seq_id = task_entity.get("seq_id")
task_load = task.get("time")
task_user_defined = task.get("user_defined", {})
subphases = task.get("subphases")
Expand Down Expand Up @@ -338,7 +339,7 @@
# Returned rank and communicators per phase
return phase_rank, rank_comm

def populate_phase(self, phase_id: int) -> List[Rank]:

Check notice on line 342 in src/lbaf/IO/lbsVTDataReader.py

View workflow job for this annotation

GitHub Actions / code-quality (ubuntu-latest, 3.8)

Too many local variables (18/15) (too-many-locals)
""" Populate phase using the JSON content."""

# Create storage for ranks
Expand Down
Loading