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

Add match results dialog #17

Merged
merged 36 commits into from
Feb 27, 2017
Merged

Add match results dialog #17

merged 36 commits into from
Feb 27, 2017

Conversation

nirizr
Copy link
Owner

@nirizr nirizr commented Aug 16, 2016

Remaining tasks:

  • Convert MatchResultsDialog to a dock-able form. - CBA, not important enough.
  • Replace web display with a drawn graph as an additional dockable form.
  • Handle cancel during the results download stage, currently network paged support does not support canceling.
  • Protect user opening multiple match dialogs.

Signed-off-by: Nir Izraeli nirizr@gmail.com

@nirizr nirizr added this to the first-release milestone Aug 16, 2016
@nirizr
Copy link
Owner Author

nirizr commented Aug 16, 2016

This if far from functional, has trivial errors atm.

@nirizr nirizr force-pushed the nirizr/match_results_dialog branch 2 times, most recently from 144b04d to 6144b31 Compare August 25, 2016 23:26
@shiftre
Copy link
Collaborator

shiftre commented Sep 19, 2016

Uh, I only skimmed it, (along with the first time), but this one should be merged only after match backend is inside, am i wrong ?

@nirizr
Copy link
Owner Author

nirizr commented Sep 19, 2016

You're right. It's far from being ready

@nirizr nirizr removed the question label Sep 19, 2016
@nirizr nirizr force-pushed the nirizr/match_results_dialog branch 13 times, most recently from 9d9c338 to 1247cd1 Compare November 3, 2016 03:14
@nirizr nirizr force-pushed the nirizr/match_results_dialog branch from 1247cd1 to 7e01c33 Compare November 8, 2016 02:16
@nirizr nirizr self-assigned this Nov 8, 2016
@nirizr nirizr force-pushed the nirizr/match_results_dialog branch 3 times, most recently from bb98f09 to 251eb05 Compare November 9, 2016 02:05
@nirizr nirizr force-pushed the nirizr/match_results_dialog branch 2 times, most recently from 8d25452 to ce701f8 Compare November 10, 2016 03:02
+ performance optimizations and some debugging

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Also, small refactor of QueryWorker and surrounding functions

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Replace delayed_query calls which potentially risked double starting a query worker (and hang).
Replace delayed_worker calls with calling query worker's start method
Simplify network delayed query interface

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Plus better exception logging

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
…caching them in MatchAction

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
…reshold is reached

* Avoid exception and remove related exception handling code

* Upload serialized instances when all functions were serialized but didn't reach upload threshold

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
Signed-off-by: Nir Izraeli <nirizr@gmail.com>
func = instances.FunctionInstance(self.file_version_id, offset)
self.instance_set.append(func.serialize())

if len(self.instance_set) >= 100 or not self.functions:
Copy link
Collaborator

Choose a reason for hiding this comment

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

You're comparing self.functions twice here, in different ways, the 2nd condition will never be met.

I don't understand this condition.

If there are no functions, return.
I also don't understand the actual condition of comparing the value to 100 and only
then uploading, what happens if there are 10?

Copy link
Owner Author

Choose a reason for hiding this comment

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

The idea here is this:
We should send objects to the server in two cases:

  1. We collected 100 instances, enough to send a request for. We'd like to consolidate multiple requests into few requests with decent size.
  2. If we just processed the last function (we poped the last one, and self.functions just became empty). We need to make sure we won't "forget" the last items if they didn't reach the bulk-size.

I know this piece of code is a bit too difficult to understand. Any ideas on how to make it clearer?

I'll also comment it so it'll be clearer.

self.cancel_upload()
self.clean()
self.delayed_queries = []

self.start_task()

def start_task(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm writing a note here but the note refers to something which is already in master.
the self.source variable does is incomplete in the conditions of 'range'and source_single.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I'm not sure I follow. Is there something to fix here? Is there something to fix for master? Would you like me to rebase again and you'll comment then?

@@ -171,24 +182,86 @@ def perform_task(self):
progress = int(r['progress'])
status = r['status']
if status == 'failed':
self.pbar.reject()
self.pbar.cancel()
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about adding some debugging or logging for a task which failed?
We'd most likely catch it earlier, but if anything is higher (nothing transport side), we'd miss it
and won't have all tasks synced.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yes. This is quite big and not really logged. I'll add logging throughout the code. Good idea!

if not self.paginate:
break

if 'next' not in response or not response['next']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wouldn't the 2nd condition fail in case we get a str response? this should separated to list / dict and str

Copy link
Owner Author

@nirizr nirizr Feb 25, 2017

Choose a reason for hiding this comment

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

self.paginate should be only true for json responses. For those response is a dictionary (edit: or a list).

What do you think of a test to make sure self.json == True and that response is a dictionary?

* more logs and a few additional comments
* validate pagination network support

Signed-off-by: Nir Izraeli <nirizr@gmail.com>
@shiftre shiftre merged commit 6d7db90 into master Feb 27, 2017
@nirizr
Copy link
Owner Author

nirizr commented Feb 27, 2017

🎉 😀 🎉

@nirizr nirizr deleted the nirizr/match_results_dialog branch June 1, 2017 21:58
@nirizr nirizr restored the nirizr/match_results_dialog branch June 1, 2017 21:58
@nirizr nirizr deleted the nirizr/match_results_dialog branch June 1, 2017 21:58
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.

2 participants