Skip to content

Commit df4cc2e

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

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
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, list)
295+
if len(value) > 1:
295296
return attr.in_(value)
296297
else:
297298
return attr == value[0]

api/simqueue/resources/statistics.py

Lines changed: 11 additions & 3 deletions
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
)
@@ -178,6 +179,7 @@ async def job_duration(requested_max: int = None, n_bins: int = 50, scale: str =
178179
status=[status],
179180
hardware_platform=[platform],
180181
size=100000,
182+
fields=["timestamp_completion", "timestamp_submission"],
181183
)
182184

183185
durations = np.array(
@@ -236,7 +238,7 @@ async def cumulative_project_count(
236238

237239
submission_dates = [
238240
res["submission_date"]
239-
for res in await db.query_projects(fields=["submission_date"], status=status)
241+
for res in await db.query_projects(fields=["submission_date"], status=status, size=10000)
240242
]
241243

242244
submission_dates.append(date.today())
@@ -265,10 +267,16 @@ async def resource_usage(start: date = None, end: date = None, interval: int = 7
265267
fields=["timestamp_completion", "resource_usage"],
266268
)
267269
completed = np.array(
268-
[(job["timestamp_completion"].date() - start).days for job in completed_jobs],
270+
[
271+
(job["timestamp_completion"].date() - start).days
272+
for job in completed_jobs
273+
if job["timestamp_completion"]
274+
],
269275
dtype=int,
270276
)
271-
usage_per_job = np.array([job["resource_usage"] for job in completed_jobs])
277+
usage_per_job = np.array(
278+
[job["resource_usage"] for job in completed_jobs if job["timestamp_completion"]]
279+
)
272280
index = completed // interval
273281
usage_per_interval[platform] = np.zeros((n_bins,))
274282
for i, usage in zip(index, usage_per_job):

0 commit comments

Comments
 (0)