Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
adc2019-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
adc2019
adc2019-system
Commits
69c61700
Commit
69c61700
authored
Aug 26, 2019
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve refresh method of the problem status view
parent
0f95798b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
72 additions
and
56 deletions
+72
-56
main.py
main.py
+9
-21
host.py
roles/host.py
+2
-1
adc2019.js
static/js/adc2019.js
+11
-10
part_problem_status.html
templates/part_problem_status.html
+1
-12
part_problem_status_list.html
templates/part_problem_status_list.html
+49
-0
part_request_status.html
templates/part_request_status.html
+0
-12
No files found.
main.py
View file @
69c61700
...
@@ -44,11 +44,17 @@ def webui_part_solver_status():
...
@@ -44,11 +44,17 @@ def webui_part_solver_status():
else
:
else
:
return
abort
(
404
)
return
abort
(
404
)
@
webui
.
route
(
'/part/request/<problem_name>'
)
# @webui.route('/part/request/<problem_name>')
def
webui_part_request_status
(
problem_name
=
None
):
@
webui
.
route
(
'/part/problem_status/<problem_name>'
)
def
webui_part_problem_status_list
(
problem_name
=
None
):
if
(
adc2019system
.
role
is
not
None
)
and
(
adc2019system
.
role
.
type
==
'host'
):
if
(
adc2019system
.
role
is
not
None
)
and
(
adc2019system
.
role
.
type
==
'host'
):
problem
=
adc2019system
.
role
.
get_problem
(
problem_name
)
solutions
=
reversed
(
sorted
(
problem
.
get_solutions
()
.
items
(),
key
=
lambda
x
:
x
[
1
]
.
timestamp
))
request_status
=
adc2019system
.
role
.
get_request_by_problem
(
problem_name
)
request_status
=
adc2019system
.
role
.
get_request_by_problem
(
problem_name
)
return
render_template
(
'part_request_status.html'
,
status
=
request_status
)
if
problem
is
None
:
return
abort
(
404
)
else
:
return
render_template
(
'part_problem_status_list.html'
,
problem
=
problem
,
solutions
=
solutions
,
status
=
request_status
)
else
:
else
:
return
abort
(
404
)
return
abort
(
404
)
...
@@ -61,31 +67,13 @@ def webui_part_problem_status(name=None):
...
@@ -61,31 +67,13 @@ def webui_part_problem_status(name=None):
if
(
adc2019system
.
role
is
not
None
)
and
(
adc2019system
.
role
.
type
==
'host'
):
if
(
adc2019system
.
role
is
not
None
)
and
(
adc2019system
.
role
.
type
==
'host'
):
problem
=
adc2019system
.
role
.
get_problem
(
name
)
problem
=
adc2019system
.
role
.
get_problem
(
name
)
workers
=
adc2019system
.
role
.
get_workers
()
workers
=
adc2019system
.
role
.
get_workers
()
# solutions = reversed(sorted(problem.get_solutions().items(), key=lambda x:x[1].timestamp))
if
problem
is
None
:
if
problem
is
None
:
return
abort
(
404
)
return
abort
(
404
)
else
:
else
:
# return render_template('part_problem_status.html', problem=problem, workers=workers, solutions=solutions)
return
render_template
(
'part_problem_status.html'
,
problem
=
problem
,
workers
=
workers
)
return
render_template
(
'part_problem_status.html'
,
problem
=
problem
,
workers
=
workers
)
else
:
else
:
return
abort
(
404
)
return
abort
(
404
)
@
webui
.
route
(
'/part/problem_solution/<name>'
)
def
webui_part_solution_status
(
name
=
None
):
if
name
is
None
:
return
abort
(
404
)
if
(
adc2019system
.
role
is
not
None
)
and
(
adc2019system
.
role
.
type
==
'host'
):
problem
=
adc2019system
.
role
.
get_problem
(
name
)
solutions
=
reversed
(
sorted
(
problem
.
get_solutions
()
.
items
(),
key
=
lambda
x
:
x
[
1
]
.
timestamp
))
if
problem
is
None
:
return
abort
(
404
)
else
:
return
render_template
(
'part_solution_status.html'
,
problem
=
problem
,
solutions
=
solutions
)
else
:
return
abort
(
404
)
@
webui
.
route
(
'/api/<path:cmd>'
,
methods
=
[
'GET'
,
'POST'
])
@
webui
.
route
(
'/api/<path:cmd>'
,
methods
=
[
'GET'
,
'POST'
])
def
webui_api
(
cmd
=
None
):
def
webui_api
(
cmd
=
None
):
...
...
roles/host.py
View file @
69c61700
...
@@ -404,6 +404,7 @@ class Request(object):
...
@@ -404,6 +404,7 @@ class Request(object):
def
set_running
(
self
):
def
set_running
(
self
):
self
.
is_processed
=
True
self
.
is_processed
=
True
if
self
.
start_time
is
None
:
self
.
start_time
=
time
.
time
()
self
.
start_time
=
time
.
time
()
def
store_response
(
self
,
data
):
def
store_response
(
self
,
data
):
...
...
static/js/adc2019.js
View file @
69c61700
...
@@ -168,22 +168,23 @@ class StatusView {
...
@@ -168,22 +168,23 @@ class StatusView {
update_status_view
(){
update_status_view
(){
var
_this
=
this
;
var
_this
=
this
;
$
.
ajax
({
type
:
'GET'
,
var
solvers
=
new
Array
();
dataType
:
'html'
,
url
:
'/part/request/'
+
_this
.
problem_key
_this
.
container
.
find
(
'#solver-list-table-wrapper .chk-solver:checked'
).
each
((
i
,
el
)
=>
{
}).
done
((
d
)
=>
{
var
_val
=
$
(
el
).
val
();
_this
.
container
.
find
(
'#request-table-container'
).
empty
();
solvers
.
push
(
_val
);
_this
.
container
.
find
(
'#request-table-container'
).
html
(
d
);
});
});
console
.
log
(
solvers
);
$
.
ajax
({
$
.
ajax
({
type
:
'GET'
,
type
:
'GET'
,
dataType
:
'html'
,
dataType
:
'html'
,
url
:
'/part/problem_s
olution
/'
+
_this
.
problem_key
url
:
'/part/problem_s
tatus
/'
+
_this
.
problem_key
}).
done
((
d
)
=>
{
}).
done
((
d
)
=>
{
_this
.
container
.
find
(
'#solution-table-container'
).
empty
();
_this
.
container
.
find
(
'#solution-table-container'
).
html
(
d
);
_this
.
container
.
find
(
'#problem-status-list-container'
).
empty
();
_this
.
container
.
find
(
'#problem-status-list-container'
).
html
(
d
);
_this
.
container
.
find
(
'.solution-detail-row.valid-solution td'
).
click
((
e
)
=>
{
_this
.
container
.
find
(
'.solution-detail-row.valid-solution td'
).
click
((
e
)
=>
{
var
solution_id
=
$
(
e
.
target
).
parent
(
"tr"
).
data
(
"solution-id"
);
var
solution_id
=
$
(
e
.
target
).
parent
(
"tr"
).
data
(
"solution-id"
);
...
...
templates/part_problem_status.html
View file @
69c61700
...
@@ -47,18 +47,7 @@
...
@@ -47,18 +47,7 @@
</div>
</div>
</div>
</div>
<div
id=
"request-list-container"
>
<div
id=
"problem-status-list-container"
>
<h4>
リクエスト一覧
</h4>
<div
id=
"request-table-container"
>
</div>
</div>
<div
id=
'solution-list-container'
>
<h4>
処理結果一覧
</h4>
<div
id=
"solution-table-container"
>
</div>
</div>
</div>
</div>
</div>
templates/part_problem_status_list.html
0 → 100644
View file @
69c61700
<div
id=
"request-list-container"
>
<h4>
リクエスト一覧
</h4>
<div
id=
"request-table-container"
>
<table
class=
"table table-bordered table-sm"
>
<tbody>
{% for r in status %}
<tr>
<td>
{{r['worker']}}
</td>
<td>
{{r['status']}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div
id=
'solution-list-container'
>
<h4>
処理結果一覧
</h4>
<div
id=
"solution-table-container"
>
<table
class=
"table table-bordered table-striped"
>
<thead>
<tr>
<th>
Timestamp
</th>
<th>
Client
</th>
<th>
Score
</th>
</tr>
</thead>
<tbody>
{% for k, v in solutions %}
{% set tr_class = '' %}
{% set tr_class = tr_class + ' submit-solution' if k == problem.best_solution else '' %}
{% set tr_class = tr_class + ' valid-solution' if v.is_valid_solution() else '' %}
<tr
class=
"solution-detail-row {{tr_class}}"
data-solution-id=
"{{k}}"
data-problem=
"{{problem.name}}"
>
<td>
{{v.timestamp_str}}
</td>
<td>
{{v.worker}}
</td>
<td>
{% if v.is_valid_solution() %}
{{v.score}} ({{v.size_str}})
{% else %}
{{v.status}}
{% endif %}
{{v.nlcheck}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
templates/part_request_status.html
deleted
100644 → 0
View file @
0f95798b
<div>
<table
class=
"table table-bordered table-sm"
>
<tbody>
{% for r in status %}
<tr>
<td>
{{r['worker']}}
</td>
<td>
{{r['status']}}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment