Loading main.py +9 −21 Changes for main.py: 9 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -44,11 +44,17 @@ def webui_part_solver_status(): else: return abort(404) @webui.route('/part/request/<problem_name>') def webui_part_request_status(problem_name=None): # @webui.route('/part/request/<problem_name>') @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'): 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) 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: return abort(404) Loading @@ -61,31 +67,13 @@ def webui_part_problem_status(name=None): if (adc2019system.role is not None) and (adc2019system.role.type == 'host'): problem = adc2019system.role.get_problem(name) workers = adc2019system.role.get_workers() # 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_problem_status.html', problem=problem, workers=workers, solutions=solutions) return render_template('part_problem_status.html', problem=problem, workers=workers) else: 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']) def webui_api(cmd=None): Loading roles/host.py +1 −0 Changes for roles/host.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -404,6 +404,7 @@ class Request(object): def set_running(self): self.is_processed = True if self.start_time is None: self.start_time = time.time() def store_response(self, data): Loading static/js/adc2019.js +11 −10 Changes for static/js/adc2019.js: 11 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -168,22 +168,23 @@ class StatusView { update_status_view(){ var _this = this; $.ajax({ type: 'GET', dataType: 'html', url: '/part/request/' + _this.problem_key }).done((d) => { _this.container.find('#request-table-container').empty(); _this.container.find('#request-table-container').html(d); var solvers = new Array(); _this.container.find('#solver-list-table-wrapper .chk-solver:checked').each((i, el) => { var _val = $(el).val(); solvers.push(_val); }); console.log(solvers); $.ajax({ type: 'GET', dataType: 'html', url: '/part/problem_solution/' + _this.problem_key url: '/part/problem_status/' + _this.problem_key }).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) => { var solution_id = $(e.target).parent("tr").data("solution-id"); Loading templates/part_problem_status.html +1 −12 Changes for templates/part_problem_status.html: 1 added line, 12 removed lines. Original line number Diff line number Diff line Loading @@ -47,18 +47,7 @@ </div> </div> <div id="request-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 id="problem-status-list-container"> </div> </div> templates/part_problem_status_list.html 0 → 100644 +49 −0 Changes for templates/part_problem_status_list.html: 49 added lines, 0 removed lines. Original line number Diff line number Diff line <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> Loading
main.py +9 −21 Changes for main.py: 9 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -44,11 +44,17 @@ def webui_part_solver_status(): else: return abort(404) @webui.route('/part/request/<problem_name>') def webui_part_request_status(problem_name=None): # @webui.route('/part/request/<problem_name>') @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'): 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) 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: return abort(404) Loading @@ -61,31 +67,13 @@ def webui_part_problem_status(name=None): if (adc2019system.role is not None) and (adc2019system.role.type == 'host'): problem = adc2019system.role.get_problem(name) workers = adc2019system.role.get_workers() # 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_problem_status.html', problem=problem, workers=workers, solutions=solutions) return render_template('part_problem_status.html', problem=problem, workers=workers) else: 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']) def webui_api(cmd=None): Loading
roles/host.py +1 −0 Changes for roles/host.py: 1 added line, 0 removed lines. Original line number Diff line number Diff line Loading @@ -404,6 +404,7 @@ class Request(object): def set_running(self): self.is_processed = True if self.start_time is None: self.start_time = time.time() def store_response(self, data): Loading
static/js/adc2019.js +11 −10 Changes for static/js/adc2019.js: 11 added lines, 10 removed lines. Original line number Diff line number Diff line Loading @@ -168,22 +168,23 @@ class StatusView { update_status_view(){ var _this = this; $.ajax({ type: 'GET', dataType: 'html', url: '/part/request/' + _this.problem_key }).done((d) => { _this.container.find('#request-table-container').empty(); _this.container.find('#request-table-container').html(d); var solvers = new Array(); _this.container.find('#solver-list-table-wrapper .chk-solver:checked').each((i, el) => { var _val = $(el).val(); solvers.push(_val); }); console.log(solvers); $.ajax({ type: 'GET', dataType: 'html', url: '/part/problem_solution/' + _this.problem_key url: '/part/problem_status/' + _this.problem_key }).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) => { var solution_id = $(e.target).parent("tr").data("solution-id"); Loading
templates/part_problem_status.html +1 −12 Changes for templates/part_problem_status.html: 1 added line, 12 removed lines. Original line number Diff line number Diff line Loading @@ -47,18 +47,7 @@ </div> </div> <div id="request-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 id="problem-status-list-container"> </div> </div>
templates/part_problem_status_list.html 0 → 100644 +49 −0 Changes for templates/part_problem_status_list.html: 49 added lines, 0 removed lines. Original line number Diff line number Diff line <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>