Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
pranjal_dhole
Flatland
Commits
a142e4bb
Commit
a142e4bb
authored
4 years ago
by
MasterScrat
Browse files
Options
Downloads
Patches
Plain Diff
Added termination cause meta info
parent
a93d9429
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/evaluators/service.py
+16
-7
16 additions, 7 deletions
flatland/evaluators/service.py
with
16 additions
and
7 deletions
flatland/evaluators/service.py
+
16
−
7
View file @
a142e4bb
...
@@ -146,8 +146,9 @@ class FlatlandRemoteEvaluationService:
...
@@ -146,8 +146,9 @@ class FlatlandRemoteEvaluationService:
os
.
makedirs
(
self
.
merge_dir
)
os
.
makedirs
(
self
.
merge_dir
)
self
.
use_pickle
=
use_pickle
self
.
use_pickle
=
use_pickle
self
.
missing_only
=
missing_only
self
.
missing_only
=
missing_only
self
.
disable_timeouts
=
disable_timeouts
self
.
episode_actions
=
[]
self
.
disable_timeouts
=
disable_timeouts
if
self
.
disable_timeouts
:
if
self
.
disable_timeouts
:
print
(
"
=
"
*
20
)
print
(
"
=
"
*
20
)
print
(
"
Timeout are DISABLED!
"
)
print
(
"
Timeout are DISABLED!
"
)
...
@@ -240,6 +241,7 @@ class FlatlandRemoteEvaluationService:
...
@@ -240,6 +241,7 @@ class FlatlandRemoteEvaluationService:
self
.
env_step_times
=
[]
self
.
env_step_times
=
[]
self
.
nb_malfunctioning_trains
=
[]
self
.
nb_malfunctioning_trains
=
[]
self
.
overall_start_time
=
0
self
.
overall_start_time
=
0
self
.
termination_cause
=
"
No reported termination cause.
"
self
.
evaluation_done
=
False
self
.
evaluation_done
=
False
self
.
begin_simulation
=
False
self
.
begin_simulation
=
False
self
.
current_step
=
0
self
.
current_step
=
0
...
@@ -651,10 +653,12 @@ class FlatlandRemoteEvaluationService:
...
@@ -651,10 +653,12 @@ class FlatlandRemoteEvaluationService:
mean_test_complete_percentage
=
np
.
mean
(
self
.
simulation_percentage_complete_per_test
[
self
.
current_test
])
mean_test_complete_percentage
=
np
.
mean
(
self
.
simulation_percentage_complete_per_test
[
self
.
current_test
])
if
mean_test_complete_percentage
<
TEST_MIN_PERCENTAGE_COMPLETE_MEAN
:
if
mean_test_complete_percentage
<
TEST_MIN_PERCENTAGE_COMPLETE_MEAN
:
print
(
"
=
"
*
15
)
print
(
"
=
"
*
15
)
print
(
"
Mean percentage done too low: {:.3f} < {}.
Evaluation will stop here.
"
.
format
(
msg
=
"
Mean percentage done too low: {:.3f} < {}.
"
.
format
(
mean_test_complete_percentage
,
mean_test_complete_percentage
,
TEST_MIN_PERCENTAGE_COMPLETE_MEAN
TEST_MIN_PERCENTAGE_COMPLETE_MEAN
))
)
print
(
msg
)
self
.
termination_cause
=
msg
self
.
evaluation_done
=
True
self
.
evaluation_done
=
True
if
self
.
simulation_count
<
len
(
self
.
env_file_paths
)
and
not
self
.
evaluation_done
:
if
self
.
simulation_count
<
len
(
self
.
env_file_paths
)
and
not
self
.
evaluation_done
:
...
@@ -750,8 +754,10 @@ class FlatlandRemoteEvaluationService:
...
@@ -750,8 +754,10 @@ class FlatlandRemoteEvaluationService:
self
.
evaluation_state
[
"
score
"
][
"
score
"
]
=
sum_normalized_reward
self
.
evaluation_state
[
"
score
"
][
"
score
"
]
=
sum_normalized_reward
self
.
evaluation_state
[
"
score
"
][
"
score_secondary
"
]
=
mean_percentage_complete
self
.
evaluation_state
[
"
score
"
][
"
score_secondary
"
]
=
mean_percentage_complete
self
.
evaluation_state
[
"
meta
"
][
"
normalized_reward
"
]
=
mean_normalized_reward
self
.
evaluation_state
[
"
meta
"
][
"
normalized_reward
"
]
=
mean_normalized_reward
self
.
evaluation_state
[
"
meta
"
][
"
termination_cause
"
]
=
self
.
termination_cause
self
.
handle_aicrowd_info_event
(
self
.
evaluation_state
)
self
.
handle_aicrowd_info_event
(
self
.
evaluation_state
)
self
.
lActions
=
[]
self
.
episode_actions
=
[]
def
handle_env_step
(
self
,
command
):
def
handle_env_step
(
self
,
command
):
"""
"""
...
@@ -780,6 +786,7 @@ class FlatlandRemoteEvaluationService:
...
@@ -780,6 +786,7 @@ class FlatlandRemoteEvaluationService:
# _command_response = self._error_template(msg)
# _command_response = self._error_template(msg)
# self.send_response(_command_response, command)
# self.send_response(_command_response, command)
# raise Exception(_command_response['payload'])
# raise Exception(_command_response['payload'])
self
.
termination_cause
=
msg
self
.
evaluation_done
=
True
self
.
evaluation_done
=
True
print
(
"
=
"
*
15
)
print
(
"
=
"
*
15
)
...
@@ -832,7 +839,7 @@ class FlatlandRemoteEvaluationService:
...
@@ -832,7 +839,7 @@ class FlatlandRemoteEvaluationService:
# record the actions before checking for done
# record the actions before checking for done
if
self
.
action_dir
is
not
None
:
if
self
.
action_dir
is
not
None
:
self
.
lA
ctions
.
append
(
action
)
self
.
episode_a
ctions
.
append
(
action
)
# Is the episode over?
# Is the episode over?
if
done
[
"
__all__
"
]:
if
done
[
"
__all__
"
]:
...
@@ -919,9 +926,9 @@ class FlatlandRemoteEvaluationService:
...
@@ -919,9 +926,9 @@ class FlatlandRemoteEvaluationService:
os
.
makedirs
(
os
.
path
.
dirname
(
sfActions
))
os
.
makedirs
(
os
.
path
.
dirname
(
sfActions
))
with
open
(
sfActions
,
"
w
"
)
as
fOut
:
with
open
(
sfActions
,
"
w
"
)
as
fOut
:
json
.
dump
(
self
.
lA
ctions
,
fOut
)
json
.
dump
(
self
.
episode_a
ctions
,
fOut
)
self
.
lA
ctions
=
[]
self
.
episode_a
ctions
=
[]
def
save_episode
(
self
):
def
save_episode
(
self
):
sfEnv
=
self
.
env_file_paths
[
self
.
simulation_count
]
sfEnv
=
self
.
env_file_paths
[
self
.
simulation_count
]
...
@@ -1050,6 +1057,7 @@ class FlatlandRemoteEvaluationService:
...
@@ -1050,6 +1057,7 @@ class FlatlandRemoteEvaluationService:
self
.
evaluation_state
[
"
meta
"
][
"
normalized_reward
"
]
=
mean_normalized_reward
self
.
evaluation_state
[
"
meta
"
][
"
normalized_reward
"
]
=
mean_normalized_reward
self
.
evaluation_state
[
"
meta
"
][
"
reward
"
]
=
mean_reward
self
.
evaluation_state
[
"
meta
"
][
"
reward
"
]
=
mean_reward
self
.
evaluation_state
[
"
meta
"
][
"
percentage_complete
"
]
=
mean_percentage_complete
self
.
evaluation_state
[
"
meta
"
][
"
percentage_complete
"
]
=
mean_percentage_complete
self
.
evaluation_state
[
"
meta
"
][
"
termination_cause
"
]
=
self
.
termination_cause
self
.
handle_aicrowd_success_event
(
self
.
evaluation_state
)
self
.
handle_aicrowd_success_event
(
self
.
evaluation_state
)
print
(
"
#
"
*
100
)
print
(
"
#
"
*
100
)
print
(
"
EVALUATION COMPLETE !!
"
)
print
(
"
EVALUATION COMPLETE !!
"
)
...
@@ -1101,6 +1109,7 @@ class FlatlandRemoteEvaluationService:
...
@@ -1101,6 +1109,7 @@ class FlatlandRemoteEvaluationService:
)
)
self
.
evaluation_state
[
"
state
"
]
=
"
ERROR
"
self
.
evaluation_state
[
"
state
"
]
=
"
ERROR
"
self
.
evaluation_state
[
"
error
"
]
=
error_message
self
.
evaluation_state
[
"
error
"
]
=
error_message
self
.
evaluation_state
[
"
meta
"
][
"
termination_cause
"
]
=
"
An error occured.
"
self
.
handle_aicrowd_error_event
(
self
.
evaluation_state
)
self
.
handle_aicrowd_error_event
(
self
.
evaluation_state
)
def
handle_aicrowd_info_event
(
self
,
payload
):
def
handle_aicrowd_info_event
(
self
,
payload
):
...
...
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