-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add management command to watch all PURLs #268
Conversation
keshav-space
commented
Jan 2, 2024
- Management command to watch and index latest version of all the PURLs
- Management command to watch and index latest version of all the PURLs Signed-off-by: Keshav Priyadarshi <git@keshav.space>
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.
This looks fine, but this is difficult to test as it looks at the whole DB at once.
If you add an option to focus the command on a PURL: this will make it easier to test even if we do not have the models yet.
See also a few minor nits.
continue | ||
|
||
version_class = VERSION_CLASS_BY_PACKAGE_TYPE.get(package.type) | ||
latest_local = package.get_latest_version() |
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.
In a next iteration, you should consider using some groupby and get all versions at once, or have a queryset that gets you the latest version automatically.
But really you likely want the missing versions rather than the latest versions.
It could be a refinement in a next iteration.
The cases I can fathom could be:
- get all the missing versions
- get the latest version (but we could have multiple ranges? ... so may be get all the latest versions in each "range"?)
- get all the newest versions after some version
try: | ||
index_of_local_version = sorted_versions.index(latest_local_version) | ||
except ValueError: | ||
self.stdout.write( |
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.
Do we have some history log entry to write in a next iteration?
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
Given that we mention watching purls, do we want this command to use the purl watch code from #271 ? |
The logic in the management command looks similar to the function here: https://github.com/nexB/purldb/blob/244-watch-model/packagedb/tasks.py#L26 @keshav-space I'm just wondering if you were going to to update this management command to use the same code from the purl watch PR in #271 or after #271 has been merged |
@JonoYang This management command in it's current implementation will watch all the PURLs irrespective of whether or not the PURL is present in PackageWatch. |
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
4012876
to
a4b1484
Compare
@keshav-space Thanks! |