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
dda8b6a6
Commit
dda8b6a6
authored
Aug 26, 2019
by
Kento HASEGAWA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the request status display
parent
26018bb4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
6 deletions
+19
-6
host.py
roles/host.py
+10
-3
data.py
utils/data.py
+9
-3
No files found.
roles/host.py
View file @
dda8b6a6
...
@@ -407,9 +407,16 @@ class Request(object):
...
@@ -407,9 +407,16 @@ class Request(object):
idx
=
data
[
'part_id'
]
idx
=
data
[
'part_id'
]
print
(
idx
)
print
(
idx
)
if
data
[
'status'
]
==
'done'
:
if
data
[
'status'
]
==
'done'
:
self
.
solved
[
idx
]
+
=
1
self
.
solved
[
idx
]
=
1
else
:
else
:
self
.
solved
[
idx
]
=
-
1
if
all
([
v
!=
0
for
v
in
self
.
solved
])
and
any
([
v
<
0
for
v
in
self
.
solved
]):
self
.
solved
[
-
1
]
=
-
1
else
:
if
data
[
'status'
]
==
'done'
:
self
.
solved
[
-
1
]
=
1
self
.
solved
[
-
1
]
=
1
else
:
self
.
solved
[
-
1
]
=
-
1
self
.
done_time
=
time
.
time
()
self
.
done_time
=
time
.
time
()
def
get_status
(
self
):
def
get_status
(
self
):
...
@@ -428,7 +435,7 @@ class Request(object):
...
@@ -428,7 +435,7 @@ class Request(object):
status
=
'Not connected'
status
=
'Not connected'
else
:
else
:
if
len
(
self
.
solved
)
==
1
:
if
len
(
self
.
solved
)
==
1
:
status_mes
=
'
Waiting for response
'
status_mes
=
'
Running
'
elif
len
(
self
.
solved
)
>
1
:
elif
len
(
self
.
solved
)
>
1
:
counter
=
sum
([
v
>
0
for
v
in
self
.
solved
])
counter
=
sum
([
v
>
0
for
v
in
self
.
solved
])
status_mes
=
f
'{counter}/{len(self.solved)}'
status_mes
=
f
'{counter}/{len(self.solved)}'
...
...
utils/data.py
View file @
dda8b6a6
...
@@ -360,10 +360,16 @@ class Problem(object):
...
@@ -360,10 +360,16 @@ class Problem(object):
idx
=
int
(
data
[
'part_id'
])
idx
=
int
(
data
[
'part_id'
])
self
.
partial_solutions
[
idx
]
.
append
(
data
)
self
.
partial_solutions
[
idx
]
.
append
(
data
)
print
([
len
(
v
)
>
0
for
v
in
self
.
partial_solutions
])
outdir
=
f
"{self.solution_path}/{self.name}"
if
not
os
.
path
.
exists
(
outdir
):
os
.
mkdir
(
outdir
)
outpath
=
f
"{outdir}/{data['request_id']}-{data['worker']}-p{data['part_id']}.json"
.
replace
(
":"
,
"."
)
with
open
(
outpath
,
'w'
)
as
fp
:
json
.
dump
(
self
.
get_dict
(),
fp
,
indent
=
4
)
# print([len(v)>0 for v in self.partial_solutions])
if
all
([
len
(
v
)
>
0
for
v
in
self
.
partial_solutions
]):
if
all
([
len
(
v
)
>
0
for
v
in
self
.
partial_solutions
]):
# for v in self.partial_solutions:
# print(v[0])
return
True
return
True
else
:
else
:
return
False
return
False
...
...
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