-
Notifications
You must be signed in to change notification settings - Fork 4
Performance improvements, documentation cleanup #21
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
Conversation
|
Travis tests seem broken but tests do complete successfully when I run them locally. |
traildb/traildb.py
Outdated
|
|
||
| if self.event_filter_obj: | ||
| if lib.tdb_cursor_set_event_filter(self.cursor, event_filter_obj.flt): | ||
| raise TrailDBError("cursor_set_event_filter failed") |
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 indentation looks wrong. How is it possible to reach this code immediately after raising an exception? @knutin
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.
It's probably just misindented. I'll pull that indentation back a bit.
traildb/traildb.py
Outdated
| if lib.tdb_cursor_set_event_filter(cursor, event_filter_obj.flt): | ||
| raise TrailDBError("cursor_set_event_filter failed") | ||
| else: | ||
| self.event_filter_obj = None |
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.
Indentation uses 3 spaces on this line
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 shall fix this.
traildb/traildb.py
Outdated
| raise TrailDBError("Failed to initalize trail in cursor") | ||
|
|
||
| if self.event_filter_obj: | ||
| if lib.tdb_cursor_set_event_filter(self.cursor, event_filter_obj.flt): |
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.
event_filter_obj should be self.event_filter_obj
traildb/traildb.py
Outdated
| Apply a whitelist of the given uuids so that only | ||
| events with the given uuids are returned by the | ||
| cursor. (Empty trails are still returned for other uuids.) | ||
| Applies a whitelist UUIDs to TrailDB so that further calls to |
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 think we're missing an of in this sentence
traildb/traildb.py
Outdated
| Apply a blacklist of the given uuids so that | ||
| only events without the given uuids are returned by the | ||
| cursor. (Empty trails are still returned for the given uuids.) | ||
| Applies a blacklist UUIDs to TrailDB so that further calls to |
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.
Same here about having an of
| The selected_uuids keyword argument can be used to select a subset | ||
| of trails to iterate over. Missing uuids are skipped over. | ||
| :param selected_uuids: If passed, only go through the UUIDs passed in | ||
| this argument. It should be an iterable that yields hex UUIDs. |
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.
Should we add an explicit check of each UUID as we iterate over it? (Or do we check already?) If performance is a concern there, then I guess any bad strings just won't be matched and a trail won't be returned for them. Maybe we need to add a comment that entries that aren't found are silently skipped and no error is raised then?
Fixed Conflicts: test/test.py traildb/traildb.py
|
Travis is failing to install libarchive-dev apparently |
Most important performance improvement in this PR is sharing of cursors in
TrailDB.trails()call. Cursors are relatively heavy so this can be a massive improvement in some workloads.Also cleaned up a whole bunch of documentation and added some sphinx configuration for that.