-
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
Create purldb scan worker #1078
Conversation
|
@JonoYang What's the latest status on this one? |
f36da81
to
068cfde
Compare
I was working on updates to the purldb and API. I've updated my management command in this PR to make sure that basic functionality works (get download url, scan package, send results back), and that we can report scan project failures to purldb. I still need to create tests for management command functions. |
This needs rebasing/merging once #1077 is merged ...because of the renamings. |
56bf92c
to
ce66932
Compare
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.
"0 means no limit. Used only for testing.", | ||
) | ||
|
||
def handle(self, *args, **options): |
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 is too complex and needs to be refactored in smaller pieces
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've refactored the code in the handle()
method. Is what I have still too complex?
class CreateProjectCommand( | ||
commands.CreateProjectCommandMixin, commands.AddInputCommandMixin, BaseCommand | ||
): | ||
pass |
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 setup seems too complex.
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 you have any suggestions on how I should test the command methods? Should I have just called create-project
using call_command
instead of putting the project creation logic into a method?
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 about having the functions related to package creation outside the Command class? Those could be at the module level, what's your take?
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.
@tdruez I am on board with that idea. What should be done about the messages that are printed using styling added by the django Command class? For instance, the calls to self.stdout.write()
and self.stderr.write()
? I think that's the main reason why I kept this code as Command mixins
1360a05
to
aa4427d
Compare
I think its alright to merge them in any order |
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Add sleep to main work loop Signed-off-by: Jono Yang <jyang@nexb.com>
* Handle exceptions in package-scan-worker and send to purldb as errors Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Remove `scanscan_project_url` from scanpipe.pipes.purldb.update_status() Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Bump matchcode-toolkit version to 4.0.0 Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
Signed-off-by: Jono Yang <jyang@nexb.com>
* Sen both traceback and exception message to purldb Signed-off-by: Jono Yang <jyang@nexb.com>
* Update management command test names Signed-off-by: Jono Yang <jyang@nexb.com>
* Move lists of statuses in poll_until_success to their own variables * Remove unnecessary else statement * Use tuples as default values for `create_project` Signed-off-by: Jono Yang <jyang@nexb.com>
* Rename get_next_job to get_next_download_url * Update tests Signed-off-by: Jono Yang <jyang@nexb.com>
aa4427d
to
76f8990
Compare
Signed-off-by: Jono Yang <jyang@nexb.com>
76f8990
to
27ad732
Compare
Signed-off-by: Jono Yang <jyang@nexb.com>
This PR is the ScanCode.io client side of the PurlDB scanning queue as designed in nexB/purldb#236