Skip to content

Commit 69a57b7

Browse files
committed
Deal with unexpected problems in data when calculating statistics, and fix some bugs
1 parent 46fd00b commit 69a57b7

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

api/dashboard/js/cumulative-user-count.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ d3.json("/statistics/cumulative-user-count", function (error, data) {
5151
});
5252

5353
d3.json(
54-
"/statistics/cumulative-user-count?platform=BrainScaleS",
54+
"/statistics/cumulative-user-count?hardware_platform=BrainScaleS",
5555
function (error, data) {
5656
if (error) return console.warn(error);
5757

@@ -104,7 +104,7 @@ d3.json(
104104
);
105105

106106
d3.json(
107-
"/statistics/cumulative-user-count?platform=BrainScaleS-2",
107+
"/statistics/cumulative-user-count?hardware_platform=BrainScaleS-2",
108108
function (error, data) {
109109
if (error) return console.warn(error);
110110

@@ -157,7 +157,7 @@ d3.json(
157157
);
158158

159159
d3.json(
160-
"/statistics/cumulative-user-count?platform=SpiNNaker",
160+
"/statistics/cumulative-user-count?hardware_platform=SpiNNaker",
161161
function (error, data) {
162162
if (error) return console.warn(error);
163163

@@ -210,7 +210,7 @@ d3.json(
210210
);
211211

212212
d3.json(
213-
"/statistics/cumulative-user-count?platform=Spikey",
213+
"/statistics/cumulative-user-count?hardware_platform=Spikey",
214214
function (error, data) {
215215
if (error) return console.warn(error);
216216

api/simqueue/db.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ async def update_log(job_id, log, append=False):
291291

292292

293293
def get_list_filter(attr, value):
294-
if len(value) > 0:
294+
assert isinstance(value, str)
295+
if len(value) > 1:
295296
return attr.in_(value)
296297
else:
297298
return attr == value[0]

api/simqueue/resources/statistics.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ async def job_count(start: date = None, end: date = None, interval: int = 7):
5858
[
5959
(timestamp["timestamp_completion"].date() - start).days
6060
for timestamp in completion_timestamps
61+
if timestamp["timestamp_completion"]
6162
],
6263
dtype=int,
6364
)
@@ -265,7 +266,11 @@ async def resource_usage(start: date = None, end: date = None, interval: int = 7
265266
fields=["timestamp_completion", "resource_usage"],
266267
)
267268
completed = np.array(
268-
[(job["timestamp_completion"].date() - start).days for job in completed_jobs],
269+
[
270+
(job["timestamp_completion"].date() - start).days
271+
for job in completed_jobs
272+
if job["timestamp_completion"]
273+
],
269274
dtype=int,
270275
)
271276
usage_per_job = np.array([job["resource_usage"] for job in completed_jobs])

0 commit comments

Comments
 (0)