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 a test program to generate a test trace sent to Python report #71

Merged
merged 34 commits into from
Jun 6, 2017

Conversation

dnesbitt61
Copy link
Contributor

Borrowed from @mxndrwgrdnr code to simulate a GPS trace from a Valhalla route.

gknisely and others added 28 commits May 30, 2017 11:52
…into report_local

Conflicts:
	py/reporter_service.py
…service,

trace_attributes, then simulates a GPS trace along the route. Calls the Python
report to generate a matched set of segments.
@dnesbitt61
Copy link
Contributor Author

This includes a lot of other improvements:
Add next segment logic and a time based threshold for reporting the last segment.
Add configuration control of levels to report segments and transitions onto next segments.
Add a debug flag that disables sending results onto the Datastore (so the request is just a test)

datastore_out['reports'].append(report)
else:
#Log this as an error
print("Speed exceeds 200kph")
Copy link
Contributor

Choose a reason for hiding this comment

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

sys.stderr.write() maybe

@@ -50,6 +51,24 @@ def serve_forever(self):
def make_thread_locals(self):
setattr(thread_local, 'segment_matcher', valhalla.SegmentMatcher())

levels = "0,1"
Copy link
Contributor

Choose a reason for hiding this comment

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

these four lines could be just:

setattr(thread_local, 'report_levels', set([ int(i) for i in os.environ.get('REPORT_LEVELS', '0,1').split(',')]))

same for the rest of these

threshold_sec = bool(strtobool(str(os.environ.get('THRESHOLD_SEC'))))
setattr(thread_local, 'threshold_sec', threshold_sec)

provider = os.environ.get('PROVIDER', '')
Copy link
Contributor

Choose a reason for hiding this comment

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

since the reporter wont be sending these to the datastore this is no longer needed. we'll be doing it in the java code

data['datastore'] = datastore_out
#Now we will send the whole segments on to the datastore
if debug == False:
if os.environ.get('DATASTORE_URL') and len(reports):
Copy link
Contributor

Choose a reason for hiding this comment

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

completely remove this sending to the datastore

segments['provider'] = thread_local.provider
prior_segment_id = None
first_seg = True
datastore_out = dict()
Copy link
Contributor

Choose a reason for hiding this comment

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

datastore_out = {}

@dnesbitt61
Copy link
Contributor Author

Fixes #37
Fixes #66
Fixes #43

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.

4 participants