Commit 41faca69 authored by Patrick Godwin's avatar Patrick Godwin

mock.py: fix JSON encoding error on python3

parent afe4ef10
Pipeline #81651 failed with stages
in 4 minutes and 27 seconds
......@@ -171,7 +171,7 @@ def generate_timeseries(start, end, measurement, fields, aggregate, dt, tags=Non
if groupby:
times = _convert_gps_times(times, epoch)
if groupby and groupby.strip('"') == 'job': ### FIXME: assume 1 tag max for now
for job_id, time in zip(range(NUM_JOBS), times):
for job_id, time in zip(range(NUM_JOBS), times.tolist()):
data = numpy.random.exponential(size=latest) + 1 ### FIXME: only works when latest = 1
row = {'columns': column_names, 'name': measurement, 'values': [[time, data.tolist()[0], str(job_id).zfill(4)]]}
series.append(row)
......@@ -183,10 +183,10 @@ def generate_timeseries(start, end, measurement, fields, aggregate, dt, tags=Non
if tags and tags[0].strip('"') == 'job': ### FIXME: assume 1 tag max for now
for job_id in range(NUM_JOBS):
data = numpy.random.exponential(size=times.size) + 1
series.extend([list(row) for row in zip(times, data, [job_id for i in range(times.size)])])
series.extend([list(row) for row in zip(times.tolist(), data.tolist(), [job_id for i in range(times.size)])])
else:
data = random_trigger_value(fields[0], times.size)
series.extend([list(row) for row in zip(times, data)])
series.extend([list(row) for row in zip(times.tolist(), data.tolist())])
### format timeseries
return [{
'name': measurement,
......@@ -210,7 +210,7 @@ def generate_triggers(start, end, measurement, fields, far_threshold, epoch='ns'
### generate triggers
data = [random_trigger_value(field, times.size, far_threshold = far_threshold) for field in fields]
series = [list(row) for row in zip(times, *data)]
series = [list(row) for row in zip(times.tolist(), *data)]
### create column name list
column_names = ['time']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment