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
| "0 means no limit. Used only for testing.", | ||
| ) | ||
|
|
||
| def handle(self, *args, **options): |
There was a problem hiding this comment.
This is too complex and needs to be refactored in smaller pieces
There was a problem hiding this comment.
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.
This setup seems too complex.
There was a problem hiding this comment.
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.
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.
@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 aboutcode-org/purldb#236