Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Coughlin
GraceDB Server
Commits
5fed23e7
Commit
5fed23e7
authored
12 years ago
by
Brian Moe
Browse files
Options
Downloads
Patches
Plain Diff
Inital submission rate chart
parent
b08bb06c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gracedb/reports.py
+43
-1
43 additions, 1 deletion
gracedb/reports.py
templates/gracedb/histogram.html
+73
-1
73 additions, 1 deletion
templates/gracedb/histogram.html
with
116 additions
and
2 deletions
gracedb/reports.py
+
43
−
1
View file @
5fed23e7
...
...
@@ -4,7 +4,10 @@ from django.template import RequestContext
from
django.shortcuts
import
render_to_response
from
django.conf
import
settings
import
os
from
gracedb.models
import
Event
from
django.db.models
import
Q
import
os
,
datetime
,
json
,
time
def
histo
(
request
):
...
...
@@ -36,6 +39,45 @@ def histo(request):
{
'
table
'
:
table
,
'
ifar
'
:
ifar
,
'
uptime
'
:
uptime
,
'
rate
'
:
json
.
dumps
(
rate_data
(
request
)),
},
context_instance
=
RequestContext
(
request
))
def
rate_data
(
request
):
# XXX there is a better way -- should be using group_by or something.
# WAAY too many queries (~300) going on here.
now
=
datetime
.
datetime
.
now
()
day
=
datetime
.
timedelta
(
1
)
ts_min
=
now
-
60
*
day
ts_max
=
now
ts_step
=
day
window_size
=
day
types
=
[
(
"
LM
"
,
Q
(
analysisType
=
"
LM
"
)),
(
"
Omega
"
,
Q
(
analysisType
=
"
Omega
"
)),
(
"
CWB
"
,
Q
(
analysisType
=
"
CWB
"
)),
(
"
MBTA
"
,
Q
(
analysisType
=
"
MBTA
"
)),
(
"
total
"
,
Q
()),
]
ts
=
ts_min
n
=
1
series
=
dict
([(
name
,
[])
for
(
name
,
_
)
in
types
])
while
ts
<=
ts_max
:
for
atype
,
q
in
types
:
series
[
atype
].
append
(
{
"
x
"
:
ts
.
strftime
(
"
%s
"
),
"
y
"
:
Event
.
objects
.
filter
(
q
).
filter
(
created__range
=
(
ts
,
ts
+
day
)).
exclude
(
group__name
=
"
Test
"
).
count
(),
})
ts
+=
ts_step
n
+=
1
# [ (ts, event_count( ts - window_size, ts) / window_size)
# for ts in range(ts_min, ts_max, ts_step) ]
return
series
This diff is collapsed.
Click to expand it.
templates/gracedb/histogram.html
+
73
−
1
View file @
5fed23e7
...
...
@@ -16,11 +16,71 @@ function toggle(id) {
}
}
</script>
<script
src=
"http://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojo/dojo.js"
data-dojo-config=
"async: true, isDebug: false, parseOnLoad: true"
>
</script>
<script>
{
%
if
rate
%
}
timeData
=
{{
rate
|
safe
}};
{
%
else
%
}
timeData
=
[
{
x
:
1
,
y
:
1
},
{
x
:
2
,
y
:
3
},
{
x
:
3
,
y
:
2
},
{
x
:
4
,
y
:
4
},
{
x
:
5
,
y
:
5
},
{
x
:
6
,
y
:
6
},
{
x
:
7
,
y
:
7
}
];
{
%
endif
%
}
require
([
"
dojo/parser
"
,
"
dojox/charting/Chart
"
,
"
dojox/charting/themes/Claro
"
,
// Shrooms, Tom
"
dojox/charting/plot2d/Lines
"
,
"
dojox/charting/widget/Legend
"
,
"
dojox/charting/axis2d/Default
"
,
"
dojo/domReady!
"
],
function
(
parser
,
Chart
,
theme
,
Lines
,
Legend
)
{
var
chart
=
new
Chart
(
"
CN
"
);
function
xlabel
(
n
)
{
console
.
log
(
"
Got:
"
+
n
);
var
dt
=
new
Date
();
dt
.
setTime
(
1000
*
n
);
return
(
dt
.
getMonth
()
+
1
)
+
"
/
"
+
dt
.
getDate
()
+
"
/
"
+
dt
.
getFullYear
();
};
chart
.
setTheme
(
theme
);
chart
.
addPlot
(
"
default
"
,
{
type
:
Lines
,
});
chart
.
addAxis
(
"
x
"
,
{
labelFunc
:
xlabel
});
chart
.
addAxis
(
"
y
"
,
{
vertical
:
true
});
chart
.
addSeries
(
"
Total
"
,
timeData
[
'
total
'
]);
chart
.
addSeries
(
"
Low Mass
"
,
timeData
[
'
LM
'
]);
chart
.
addSeries
(
"
Omega
"
,
timeData
[
'
Omega
'
]);
chart
.
addSeries
(
"
MBTA
"
,
timeData
[
'
MBTA
'
]);
chart
.
addSeries
(
"
cWB
"
,
timeData
[
'
CWB
'
]);
chart
.
render
();
var
legend
=
new
Legend
({
chart
:
chart
},
"
leg1
"
);
}
);
</script>
{% endblock %}
{% block content %}
<br/>
<a
name=
"latency"
href=
"javascript:toggle('latency');"
><h3>
Latency
</h3></a>
<div
id=
"latency"
style=
"display:none;"
>
...
...
@@ -59,6 +119,18 @@ function toggle(id) {
{% endif %}
</div>
<br/>
<br/>
<a
name=
"rate"
href=
"javascript:toggle('rate');"
><h3>
Submission Rates
</h3></a>
<div
id=
"rate"
style=
"display: block;"
>
{% if rate %}
<div
id=
"CN"
style=
"width: 750px; height: 450px;"
></div>
<div
id=
"leg1"
></div>
{% else %}
No rate charts.
{% endif %}
</div>
{% endblock %}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment