-
Notifications
You must be signed in to change notification settings - Fork 82
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
Check dataset connection before migration job (and other apps) #792
Conversation
Codecov ReportBase: 90.72% // Head: 90.66% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #792 +/- ##
==========================================
- Coverage 90.72% 90.66% -0.06%
==========================================
Files 105 105
Lines 5259 5292 +33
==========================================
+ Hits 4771 4798 +27
- Misses 488 494 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
The documentation is not available anymore as the PR was closed or merged. |
d280c69
to
b1b0329
Compare
c284964
to
a334a52
Compare
b1b0329
to
66b475c
Compare
a334a52
to
92948e6
Compare
92948e6
to
4c1d030
Compare
4c1d030
to
ce2b651
Compare
@rtrompier this PR should fix #763. |
): | ||
if cache_resource.check() is False: | ||
logging.info( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if it should be an info, maybe Warning since it will avoid running the migrations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits below...
As this function returns a boolean, maybe you could try to find a name using the third-person singular, like the pathlib does for path.exists()
...
if libraries_resource.check() is False: | ||
raise RuntimeError("The datasets and numba libraries could not be configured. Exiting.") | ||
if cache_resource.check() is False: | ||
raise RuntimeError("The connection to the cache database could not be established. Exiting.") | ||
if queue_resource.check() is False: | ||
raise RuntimeError("The connection to the queue database could not be established. Exiting.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -51,6 +51,9 @@ def allocate(self): | |||
storage_paths.add(self.numba_path) | |||
self.storage_paths = storage_paths | |||
|
|||
def check(self) -> bool: | |||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had put check() in the base class with NotImplementedError, so I had to implement it. But it was poor design, I moved it to MongoResource, now it's more logical.
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
Co-authored-by: Albert Villanova del Moral <[email protected]>
good advice, I'll try to remember it for the next time too |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Thanks for the reviews!!! |
Before starting the services (api, admin) and workers, we ensure the database is accessible and the assets directory (if needed) exists.
In the case of the migration job: if the database cannot be accessed, we skip the migration, to avoid blocking Helm
Fixes #763. Replaces #767. Depends on #791.