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

Dependency bug fix #342

Merged
merged 1 commit into from
Apr 15, 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
19 changes: 14 additions & 5 deletions network_wrangler/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def check_scenario_conflicts(self) -> bool:

Returns: boolean indicating if the check was successful or returned an error
"""

WranglerLogger.info("Checking Scenario Conflicts")
conflict_dict = self.conflicts
scenario_projects = [p.project for p in self.project_cards]

Expand All @@ -427,7 +427,7 @@ def check_scenario_requisites(self) -> bool:

Returns: boolean indicating if the checks were successful or returned an error
"""

WranglerLogger.info("Checking Scenario Requisites")
corequisite_dict = self.corequisites
prerequisite_dict = self.prerequisites

Expand Down Expand Up @@ -463,7 +463,10 @@ def order_project_cards(self):

Returns: ordered list of project cards to be applied to scenario
"""

WranglerLogger.info("Ordering Project Cards")
WranglerLogger.info(
"Project Cards: {}".format([p.project for p in self.project_cards])
)
scenario_projects = [p.project.lower() for p in self.project_cards]

# build prereq (adjacency) list for topological sort
Expand All @@ -478,12 +481,18 @@ def order_project_cards(self):
if (
prereq.lower() in scenario_projects
): # this will always be true, else would have been flagged in missing prerequsite check, but just in case
adjacency_list[prereq.lower()] = [project]
if adjacency_list.get(prereq.lower()):
adjacency_list[prereq.lower()].append(project)
else:
adjacency_list[prereq.lower()] = [project]

WranglerLogger.debug("Adjacency List: {}".format(adjacency_list))

# sorted_project_names is topological sorted project card names (based on prerequsiite)
sorted_project_names = topological_sort(
adjacency_list=adjacency_list, visited_list=visited_list
)
WranglerLogger.info("Sorted Project Names: {}".format(sorted_project_names))

# get the project card objects for these sorted project names
project_card_and_name_dict = {}
Expand Down Expand Up @@ -515,7 +524,7 @@ def order_project_cards(self):
)
self.project_cards = sorted_project_cards

WranglerLogger.debug("Project Cards: {}".format(self.project_cards))
WranglerLogger.debug("Project Cards: {}".format([p.project for p in self.project_cards]))

return sorted_project_cards

Expand Down