-
Notifications
You must be signed in to change notification settings - Fork 68
[WIP] API server code health pass #1058
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
6cb6e81
to
28bc63e
Compare
28bc63e
to
22d505d
Compare
753a913
to
d0c7da0
Compare
d0c7da0
to
9451599
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.
Instead of letting this snowball into one huge megalithic PR (encompassing many different types of changes) that auto-closes the referenced issue, it might be better to create smaller targeted PRs (that are more easily digested individually) and then ultimately close the PR by hand. It'll simplify the overall review process by separating concerns.
I don't think "XyzFilter" (TimeFilter, GeoFilter, etc) is a great option for renaming... Its not really a "filter" until it is applied, and there isnt anything about these objects (that specify sets of times/locations/signalnames) that is intrinsically filter-like. How about "TimeSpec" instead (or i could even be convinced to use "TimeSet")? I apologize, i should have been more explicit in my issue comment on the "TimePair" name being bad, and suggested these options then.
@@ -15,7 +15,7 @@ def get_argument_parser(): | |||
|
|||
parser = argparse.ArgumentParser() | |||
parser.add_argument("--log_file", help="filename for log output") | |||
parser.add_argument("--num_threads", type=int, help="number of worker threads to spawn for processing source/signal pairs") | |||
parser.add_argument("--num_threads", type=int, help="number of worker threads to spawn for processing source/signal filters") |
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.
parser.add_argument("--num_threads", type=int, help="number of worker threads to spawn for processing source/signal filters") | |
parser.add_argument("--num_threads", type=int, help="number of worker threads to spawn for processing source/signal pairs") |
this was acceptable usage, each unique pair of (source,signal) makes up a workload
@@ -551,7 +551,7 @@ def worker(): | |||
try: | |||
while True: | |||
(source, signal) = srcsigs.get_nowait() # this will throw the Empty caught below | |||
logger.info("starting pair", thread=name, pair=f"({source}, {signal})") | |||
logger.info("starting filter", thread=name, filter=f"({source}, {signal})") |
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.
logger.info("starting filter", thread=name, filter=f"({source}, {signal})") | |
logger.info("starting pair", thread=name, pair=f"({source}, {signal})") |
this was acceptable usage, each unique pair of (source,signal) makes up a workload
return [v for vs in s for v in vs.split(",")] | ||
|
||
|
||
IntRange = Union[Tuple[int, int], int] |
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 only referenced in one place... we should either remove it or expand its usage.
if issues: | ||
_apply_issues_filter(q, issues) | ||
elif lag is not None: | ||
_apply_lag_filter(q, lag) | ||
elif as_of is not None: | ||
_apply_as_of_filter(q, as_of) |
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 seems silly to check if field
/ if field is not None
here when each of these methods do the same test internally. it also seems silly to silently leave out a filtering condition for lag
when issue
is also specified, or to leave out as_of
when lag
or issue
is specified... i claim that either (1) these 3 conditions should all be applied to the resulting SQL if they are specified in any combination, or (2) an error should be produced if they are truly intended to be mutually exclusive. i think it is more correct to do the former; that is, leave out the if/elif/elif
lines and just call the 3 methods here. thoughts?
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.
Applying all three makes sense if it won't break any existing workflows!
@melange396 thanks for the comments! I'll close this off for now and split it into a few separate PRs. |
Closes #998.
Prerequisites:
dev
branchdev
Summary
Fixes a set of issues in the server code as seen here.
_handle_lag_issues_as_of()
set_order()
get_related_signals()
_db.py
, move configuration settings which are actually used elsewhereparse
&extract
to proper locationflask.request
referencesparse
&extract
to match their actual purpose