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
b304b574
Commit
b304b574
authored
5 years ago
by
spmohanty
Browse files
Options
Downloads
Patches
Plain Diff
Addresses #220 - Implements a version match check between the client and the service
parent
e09dc410
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/evaluators/client.py
+5
-2
5 additions, 2 deletions
flatland/evaluators/client.py
flatland/evaluators/service.py
+17
-0
17 additions, 0 deletions
flatland/evaluators/service.py
with
22 additions
and
2 deletions
flatland/evaluators/client.py
+
5
−
2
View file @
b304b574
...
@@ -10,6 +10,7 @@ import msgpack_numpy as m
...
@@ -10,6 +10,7 @@ import msgpack_numpy as m
import
numpy
as
np
import
numpy
as
np
import
redis
import
redis
import
flatland
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.envs.predictions
import
ShortestPathPredictorForRailEnv
from
flatland.envs.predictions
import
ShortestPathPredictorForRailEnv
from
flatland.envs.rail_env
import
RailEnv
from
flatland.envs.rail_env
import
RailEnv
...
@@ -146,11 +147,13 @@ class FlatlandRemoteClient(object):
...
@@ -146,11 +147,13 @@ class FlatlandRemoteClient(object):
"""
"""
_request
=
{}
_request
=
{}
_request
[
'
type
'
]
=
messages
.
FLATLAND_RL
.
PING
_request
[
'
type
'
]
=
messages
.
FLATLAND_RL
.
PING
_request
[
'
payload
'
]
=
{}
_request
[
'
payload
'
]
=
{
"
version
"
:
flatland
.
__version__
}
_response
=
self
.
_blocking_request
(
_request
)
_response
=
self
.
_blocking_request
(
_request
)
if
_response
[
'
type
'
]
!=
messages
.
FLATLAND_RL
.
PONG
:
if
_response
[
'
type
'
]
!=
messages
.
FLATLAND_RL
.
PONG
:
raise
Exception
(
raise
Exception
(
"
Unable to perform handshake with the
redis
service.
\
"
Unable to perform handshake with the
evaluation
service.
\
Expected PONG; received {}
"
.
format
(
json
.
dumps
(
_response
)))
Expected PONG; received {}
"
.
format
(
json
.
dumps
(
_response
)))
else
:
else
:
return
True
return
True
...
...
This diff is collapsed.
Click to expand it.
flatland/evaluators/service.py
+
17
−
0
View file @
b304b574
...
@@ -8,6 +8,7 @@ import shutil
...
@@ -8,6 +8,7 @@ import shutil
import
time
import
time
import
traceback
import
traceback
import
flatland
import
crowdai_api
import
crowdai_api
import
msgpack
import
msgpack
import
msgpack_numpy
as
m
import
msgpack_numpy
as
m
...
@@ -283,10 +284,26 @@ class FlatlandRemoteEvaluationService:
...
@@ -283,10 +284,26 @@ class FlatlandRemoteEvaluationService:
"""
"""
Handles PING command from the client.
Handles PING command from the client.
"""
"""
service_version
=
flatland
.
__version__
if
"
version
"
in
command
[
"
payload
"
].
keys
():
client_version
=
command
[
"
payload
"
][
"
version
"
]
else
:
# 2.1.4 -> when the version mismatch check was added
client_version
=
"
2.1.4
"
_command_response
=
{}
_command_response
=
{}
_command_response
[
'
type
'
]
=
messages
.
FLATLAND_RL
.
PONG
_command_response
[
'
type
'
]
=
messages
.
FLATLAND_RL
.
PONG
_command_response
[
'
payload
'
]
=
{}
_command_response
[
'
payload
'
]
=
{}
if
client_version
!=
service_version
:
_command_response
[
'
type
'
]
=
messages
.
FLATLAND_RL
.
ERROR
_command_response
[
'
payload
'
][
'
message
'
]
=
\
"
Client-Server Version Mismatch =>
"
+
\
"
[ Client Version : {} ]
"
.
format
(
client_version
)
+
\
"
[ Server Version : {} ]
"
.
format
(
service_version
)
self
.
send_response
(
_command_response
,
command
)
raise
Exception
(
_command_response
[
'
payload
'
][
'
message
'
])
self
.
send_response
(
_command_response
,
command
)
self
.
send_response
(
_command_response
,
command
)
def
handle_env_create
(
self
,
command
):
def
handle_env_create
(
self
,
command
):
...
...
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