Skip to content

Commit

Permalink
Check version compatibility during session connecting (#403)
Browse files Browse the repository at this point in the history
* check version compatibility during session connecting
  • Loading branch information
lidongze0629 committed Jun 10, 2021
1 parent 5f1b5b0 commit 131fea7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
11 changes: 11 additions & 0 deletions coordinator/gscoordinator/coordinator.py
Expand Up @@ -38,6 +38,7 @@
from io import StringIO

import grpc
from packaging import version

from gscoordinator.io_utils import StdoutWrapper

Expand Down Expand Up @@ -214,6 +215,16 @@ def ConnectSession(self, request, context):
self._streaming_logs = True
sys.stdout.drop(False)

# check version compatibility from client
sv = version.parse(__version__)
cv = version.parse(self._request.version)
if sv.major != cv.major or sv.minor != cv.minor:
logger.warning(
"Version between client and server is inconsistent: %s vs %s",
self._request.version,
__version__,
)

return self._make_response(
message_pb2.ConnectSessionResponse,
code=error_codes_pb2.OK,
Expand Down
6 changes: 4 additions & 2 deletions coordinator/gscoordinator/template/CMakeLists.template
Expand Up @@ -138,7 +138,8 @@ if (CYTHON_PREGEL_APP)
${VINEYARD_LIBRARIES}
${LIBGRAPELITE_LIBRARIES}
${GLOG_LIBRARIES}
${ARROW_SHARED_LIB})
${ARROW_SHARED_LIB}
${PROTO})
set_target_properties(${FRAME_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")
elseif (CYTHON_PIE_APP)
file(GLOB_RECURSE FILES_NEED_COMPILE "*.cc")
Expand All @@ -155,7 +156,8 @@ elseif (CYTHON_PIE_APP)
${VINEYARD_LIBRARIES}
${LIBGRAPELITE_LIBRARIES}
${GLOG_LIBRARIES}
${ARROW_SHARED_LIB})
${ARROW_SHARED_LIB}
${PROTO})
set_target_properties(${FRAME_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")
elseif (PROPERTY_GRAPH_FRAME)
add_library(${FRAME_NAME} SHARED ${ANALYTICAL_ENGINE_FRAME_DIR}/property_graph_frame.cc)
Expand Down
2 changes: 1 addition & 1 deletion interactive_engine/src/data_load_tools/README.md
Expand Up @@ -56,7 +56,7 @@ skip.header=true
| separator | false | \\\\\| | Seperator used to parse each field in a line |
| input.path | true | - | Input HDFS dir |
| output.path | true | - | Output HDFS dir |
| graph.endpoint | true | - | RPC endpoint of the graph storage service. You can get the RPC endpoint following this document: [GraphScope Store Service](https://github.com/alibaba/GraphScope/tree/main/charts/graphscope-store-service) |
| graph.endpoint | true | - | RPC endpoint of the graph storage service. You can get the RPC endpoint following this document: [GraphScope Store Service](https://github.com/alibaba/GraphScope/tree/main/charts/graphscope-store) |
| column.mapping.config | true | - | Mapping info for each input file in JSON format. Each key in the first level should be a fileName that can be found in the `input.path`, and the corresponding value defines the mapping info. For a vertex type, the mapping info should includes 1) `label` of the vertex type, 2) `propertiesColMap` that describes the mapping from input field to graph property in the format of `{ columnIdx: "propertyName" }`. For an edge type, the mapping info should includes 1) `label` of the edge type, 2) `srcLabel` of the source vertex type, 3) `dstLabel` of the destination vertex type, 4) `srcPkColMap` that describes the mapping from input field to graph property of the primary keys in the source vertex type, 5) `dstPkColMap` that describes the mapping from input field to graph property of the primary keys in the destination vertex type, 6) `propertiesColMap` that describes the mapping from input field to graph property of the edge type |
|skip.header|false|true|Whether to skip the first line of the input file|

Expand Down
2 changes: 2 additions & 0 deletions proto/message.proto
Expand Up @@ -43,6 +43,8 @@ message ResponseStatus {
message ConnectSessionRequest {
bool cleanup_instance = 1;
int32 dangling_timeout_seconds = 2;
// check version compatibility
string version = 3;
}

message ConnectSessionResponse {
Expand Down
2 changes: 2 additions & 0 deletions python/graphscope/client/rpc.py
Expand Up @@ -33,6 +33,7 @@
from graphscope.proto import coordinator_service_pb2_grpc
from graphscope.proto import error_codes_pb2
from graphscope.proto import message_pb2
from graphscope.version import __version__

logger = logging.getLogger("graphscope")

Expand Down Expand Up @@ -212,6 +213,7 @@ def _connect_session_impl(self, cleanup_instance=True, dangling_timeout_seconds=
request = message_pb2.ConnectSessionRequest(
cleanup_instance=cleanup_instance,
dangling_timeout_seconds=dangling_timeout_seconds,
version=__version__,
)

response = self._stub.ConnectSession(request)
Expand Down
10 changes: 6 additions & 4 deletions python/graphscope/client/session.py
Expand Up @@ -55,7 +55,6 @@
from graphscope.framework.errors import InteractiveEngineInternalError
from graphscope.framework.errors import InvalidArgumentError
from graphscope.framework.errors import K8sError
from graphscope.framework.errors import LearningEngineInternalError
from graphscope.framework.errors import check_argument
from graphscope.framework.graph import Graph
from graphscope.framework.graph import GraphDAGNode
Expand Down Expand Up @@ -733,7 +732,7 @@ def close(self):
try:
if instance is not None:
instance.close()
except InteractiveEngineInternalError:
except Exception:
pass
self._interactive_instance_dict.clear()

Expand All @@ -742,12 +741,15 @@ def close(self):
try:
if instance is not None:
instance.close()
except LearningEngineInternalError:
except Exception:
pass
self._learning_instance_dict.clear()

if self._grpc_client:
self._grpc_client.close()
try:
self._grpc_client.close()
except Exception:
pass
self._grpc_client = None
_session_dict.pop(self._session_id, None)

Expand Down

0 comments on commit 131fea7

Please sign in to comment.