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

fix(issue#6): Ensured wordnet and stopwords are loaded before used. #7

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

KamenDimitrov97
Copy link
Contributor

@KamenDimitrov97 KamenDimitrov97 commented Aug 21, 2024

🐛 Bug Fix

Description

WordNetCorpusReader to have no attribute LazyCorpusLoader issue in production server.
Issue ticket: #6

Root Cause:

The bug is caused due to WordNetCorpusReader object, used in the WordnetLemmatizer, hasn't fully loaded when the server, where we're calling CategoryManager, is ready to make requests. WordNetCorpusReader has a placeholder object , called LazyCorpusLoader, to ensure other object load concurrently.

Testing:

I've updated our environment with the new release to make sure server isn't ready to take calls when the WordNetCorpusReader is still loading.

Steps to reproduce:

Can be found in issue #6

Screenshots:

Logs
Logs showing LazyCorpusLoader before and after ensuring WordNetCorpusReader has loaded, all before startup of server. Logs removed after test.

Checklist

  • I have included a clear description of the bug.
  • I have listed the steps to reproduce the issue.
  • I have run the test suite and verified it passes.
  • I have attached any relevant logs or screenshots.

Who can review?

@philtweir

@KamenDimitrov97 KamenDimitrov97 self-assigned this Aug 21, 2024
@KamenDimitrov97 KamenDimitrov97 linked an issue Aug 21, 2024 that may be closed by this pull request
2 tasks
COPY src /app/build/src
COPY bonn /app/build/bonn
COPY pyproject.toml /app/build
COPY python/bonn /app/build/bonn
Copy link
Contributor

Choose a reason for hiding this comment

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

So presumably the build was broken until this change as src and bonn were in different levels?

Copy link
Contributor Author

@KamenDimitrov97 KamenDimitrov97 Aug 21, 2024

Choose a reason for hiding this comment

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

I'm not sure how the release was fine and where this happened, as I was a bit pressed for time on mrn, but when I tried to rebuild it locally bonn wasn't available only _bonn which is why I did this change.
Even after unziping the wheel only package available was _bonn.
Before the directory structure is:

├── _bonn/ # SRC code files
│ ├── _bonn.so file

Now it's :
├── bonn/ # Source code files
│ ├── _bonn.so file
│ ├── extract.py
│ ├── category_manager.py
│ ├── all bonn.py files

Copy link
Contributor Author

@KamenDimitrov97 KamenDimitrov97 Aug 21, 2024

Choose a reason for hiding this comment

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

After release I'm going to try on our onyx environment if there's any issues before writing to onyx.
Release shouldn't be an issue in their production environment. Because the bonn version they're using is 0.1.5 and I've updated for release to 0.1.6.
version used in ons

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
The previous error.

@KamenDimitrov97 KamenDimitrov97 merged commit 53f8ce7 into main Aug 21, 2024
24 checks passed
KamenDimitrov97 added a commit that referenced this pull request Aug 21, 2024
…r-has-no-att

fix(issue#6): Ensured wordnet and stopwords are loaded before used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 WordNetCorpusReader has no attribute LazyCorpusLoader
2 participants