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

Vocab refresh: Update networkx graphs #883

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

joeflack4
Copy link
Member

@joeflack4 joeflack4 commented Sep 18, 2024

addresses #856

DB Refresh: relationship_graph fix

  • Update: When app starts and also every time home route is hit, it will now update relationship_graph if it is out of date.

@joeflack4 joeflack4 linked an issue Sep 18, 2024 that may be closed by this pull request
3 tasks
@joeflack4 joeflack4 changed the title DB Refresh: relationship_graph fix Vocab refresh: Update networkx graphs Sep 18, 2024
@joeflack4 joeflack4 marked this pull request as draft September 18, 2024 01:54
@joeflack4 joeflack4 self-assigned this Sep 18, 2024
@joeflack4 joeflack4 added the bug Something isn't working label Sep 18, 2024
@joeflack4 joeflack4 force-pushed the voc-refresh-graph-update branch 3 times, most recently from a79d2ad to efa55cd Compare October 3, 2024 06:10
@@ -375,23 +352,26 @@ def create_rel_graphs(save_to_pickle: bool) -> DiGraph:
return G # , Gu


def load_relationship_graph(save_if_not_exists=True):
def is_graph_up_to_date(graph_path: str = GRAPH_PATH) -> bool:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: is_graph_up_to_date()

# break # End of file reached
timer(f'loading {graph_path}')
up_to_date = True if not update_if_outdated else is_graph_up_to_date(GRAPH_PATH)
if os.path.isfile(graph_path) and up_to_date:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If not true, triggers creation / save of new graph.

# d += 1
# n = p
# raise Exception(f"can't find root for {node}")
REL_GRAPH = load_relationship_graph()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Activates: On server start

Since this file gets imported during server start, this line runs.

# d += 1
# n = p
# raise Exception(f"can't find root for {node}")
REL_GRAPH = load_relationship_graph()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Activate on cron or hitting of home route

- Update: When app starts and also every time home route is hit, it will now update relationship_graph if it is out of date.

General updates
- Codestyle and comment updates
- Moved some code that was causing PyCharm debugger to run tests inside of a non-test file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 1. In progress / sprint
Development

Successfully merging this pull request may close these issues.

Vocab refresh: Update networkx graphs
1 participant