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
b2044029
Commit
b2044029
authored
Aug 23, 2019
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the request status display in the problem view
parent
aa7af10d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
59 deletions
+11
-59
main.py
main.py
+1
-4
host.py
roles/host.py
+6
-3
adc2019.js
static/js/adc2019.js
+4
-32
part_problem_status.html
templates/part_problem_status.html
+0
-20
No files found.
main.py
View file @
b2044029
...
@@ -44,12 +44,9 @@ def webui_part_solver_status():
...
@@ -44,12 +44,9 @@ def webui_part_solver_status():
else
:
else
:
return
abort
(
404
)
return
abort
(
404
)
# @webui.route('/part/request/<request_id>')
@
webui
.
route
(
'/part/request/<problem_name>'
)
@
webui
.
route
(
'/part/request/<problem_name>'
)
# def webui_part_request_status(request_id=None):
def
webui_part_request_status
(
problem_name
=
None
):
def
webui_part_request_status
(
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'
):
# request_status = adc2019system.role.get_request_status(float(request_id))
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
)
return
render_template
(
'part_request_status.html'
,
status
=
request_status
)
else
:
else
:
...
@@ -64,7 +61,7 @@ def webui_part_problem_status(name=None):
...
@@ -64,7 +61,7 @@ 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
[
0
]
))
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
:
...
...
roles/host.py
View file @
b2044029
...
@@ -354,6 +354,8 @@ class Request(object):
...
@@ -354,6 +354,8 @@ class Request(object):
self
.
solvers
=
solvers
self
.
solvers
=
solvers
self
.
response
=
dict
()
self
.
response
=
dict
()
for
w
in
self
.
solvers
:
self
.
response
[
w
]
=
list
()
@
property
@
property
def
request_data
(
self
):
def
request_data
(
self
):
...
@@ -370,7 +372,8 @@ class Request(object):
...
@@ -370,7 +372,8 @@ class Request(object):
def
store_response
(
self
,
data
):
def
store_response
(
self
,
data
):
worker
=
data
[
'worker'
]
worker
=
data
[
'worker'
]
self
.
response
[
worker
]
=
data
self
.
response
[
worker
]
.
append
(
data
)
# self.response[worker] = data
def
get_status
(
self
):
def
get_status
(
self
):
worker_count
=
0
worker_count
=
0
...
@@ -401,8 +404,8 @@ class Request(object):
...
@@ -401,8 +404,8 @@ class Request(object):
worker_status
=
dict
()
worker_status
=
dict
()
for
v
in
self
.
solvers
:
for
v
in
self
.
solvers
:
if
v
in
self
.
response
:
if
v
in
self
.
response
and
len
(
self
.
response
[
v
])
>
0
:
worker_status
[
v
]
=
self
.
response
[
v
][
'status'
]
worker_status
[
v
]
=
self
.
response
[
v
][
0
][
'status'
]
else
:
else
:
if
self
.
worker_manager
.
workers
[
v
]
.
status
==
'Not connected'
:
if
self
.
worker_manager
.
workers
[
v
]
.
status
==
'Not connected'
:
worker_status
[
v
]
=
'Not connected'
worker_status
[
v
]
=
'Not connected'
...
...
static/js/adc2019.js
View file @
b2044029
...
@@ -63,10 +63,10 @@ class StatusView {
...
@@ -63,10 +63,10 @@ class StatusView {
}
}
}).
trigger
(
'change'
);
}).
trigger
(
'change'
);
// _this.solver_status
_refresh_timer = setInterval((function _t(){
_this
.
request
_refresh_timer
=
setInterval
((
function
_t
(){
// _this.refresh_solver
_status();
_this
.
get_request
_status
();
//
return _t;
return
_t
;
//
}()), 1000);
}()),
1000
);
});
});
}
}
...
@@ -114,11 +114,6 @@ class StatusView {
...
@@ -114,11 +114,6 @@ class StatusView {
// _this.stop_solver();
// _this.stop_solver();
// });
// });
_this
.
request_refresh_timer
=
setInterval
((
function
_t
(){
// _this.get_request_status(request_id);
_this
.
get_request_status
();
return
_t
;
}()),
1000
);
});
});
}
}
...
@@ -174,22 +169,6 @@ class StatusView {
...
@@ -174,22 +169,6 @@ class StatusView {
});
});
}
}
// get_request_status(request_id){
// var _this = this;
// $.ajax({
// type: 'GET',
// dataType: 'html',
// url: '/part/request/' + request_id
// }).done((d) => {
// _this.container.find('#request-status-container').empty();
// _this.container.find('#request-status-container').html(d);
// status = $(d).find('#request-status-value').text();
// if(status == 'done'){
// clearInterval(_this.request_refresh_timer);
// }
// });
// }
get_request_status
(){
get_request_status
(){
var
_this
=
this
;
var
_this
=
this
;
$
.
ajax
({
$
.
ajax
({
...
@@ -199,13 +178,6 @@ class StatusView {
...
@@ -199,13 +178,6 @@ class StatusView {
}).
done
((
d
)
=>
{
}).
done
((
d
)
=>
{
_this
.
container
.
find
(
'#request-table-container'
).
empty
();
_this
.
container
.
find
(
'#request-table-container'
).
empty
();
_this
.
container
.
find
(
'#request-table-container'
).
html
(
d
);
_this
.
container
.
find
(
'#request-table-container'
).
html
(
d
);
// status = $(d).find('#request-status-value').text();
// if(status == 'done'){
// clearInterval(_this.request_refresh_timer);
// }
// _this.fire('refresh');
});
});
}
}
...
...
templates/part_problem_status.html
View file @
b2044029
...
@@ -86,23 +86,3 @@
...
@@ -86,23 +86,3 @@
</div>
</div>
</div>
</div>
<div
class=
"modal fade"
id=
"solver-processing-modal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"solver-processing-modal-title"
aria-hidden=
"true"
>
<div
class=
"modal-dialog modal-dialog-centered modal-lg"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"solver-processing-modal-title"
>
{{problem.name}}
</h5>
<!-- <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button> -->
</div>
<div
class=
"modal-body"
id=
"request-status-container"
>
処理中...
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-danger stop-button"
>
Stop
</button>
<button
type=
"button"
class=
"btn btn-primary"
data-dismiss=
"modal"
>
Close
</button>
</div>
</div>
</div>
</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