Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
ddd249f2
Commit
ddd249f2
authored
Jul 26, 2018
by
eqy
Committed by
Tianqi Chen
Jul 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perfom full rpc tracker handshake (#1500)
parent
bcc17658
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
0 deletions
+13
-0
jvm/core/src/main/java/ml/dmlc/tvm/rpc/ConnectTrackerServerProcessor.java
+12
-0
jvm/core/src/main/java/ml/dmlc/tvm/rpc/RPC.java
+1
-0
No files found.
jvm/core/src/main/java/ml/dmlc/tvm/rpc/ConnectTrackerServerProcessor.java
View file @
ddd249f2
...
@@ -201,6 +201,12 @@ public class ConnectTrackerServerProcessor implements ServerProcessor {
...
@@ -201,6 +201,12 @@ public class ConnectTrackerServerProcessor implements ServerProcessor {
if
(
trackerMagic
!=
RPC
.
RPC_TRACKER_MAGIC
)
{
if
(
trackerMagic
!=
RPC
.
RPC_TRACKER_MAGIC
)
{
throw
new
SocketException
(
"failed to connect to tracker (WRONG MAGIC)"
);
throw
new
SocketException
(
"failed to connect to tracker (WRONG MAGIC)"
);
}
}
String
infoJSON
=
generateCinfo
(
key
);
Utils
.
sendString
(
trackerOut
,
infoJSON
);
int
recvCode
=
Integer
.
parseInt
(
Utils
.
recvString
(
trackerIn
));
if
(
recvCode
!=
RPC
.
TrackerCode
.
SUCCESS
)
{
throw
new
SocketException
(
"failed to connect to tracker (not SUCCESS)"
);
}
return
trackerSocket
;
return
trackerSocket
;
}
}
...
@@ -239,6 +245,12 @@ public class ConnectTrackerServerProcessor implements ServerProcessor {
...
@@ -239,6 +245,12 @@ public class ConnectTrackerServerProcessor implements ServerProcessor {
}
}
// handcrafted JSON
// handcrafted JSON
private
String
generateCinfo
(
String
key
)
{
String
cinfo
=
"{\"key\" : "
+
"\"server:"
+
key
+
"\"}"
;
return
"["
+
RPC
.
TrackerCode
.
UPDATE_INFO
+
", "
+
cinfo
+
"]"
;
}
// handcrafted JSON
private
String
generatePut
(
int
code
,
String
key
,
int
port
,
String
matchKey
)
{
private
String
generatePut
(
int
code
,
String
key
,
int
port
,
String
matchKey
)
{
return
"["
+
code
+
", "
+
"\""
+
key
+
"\""
+
", "
+
"["
+
port
+
", "
return
"["
+
code
+
", "
+
"\""
+
key
+
"\""
+
", "
+
"["
+
port
+
", "
+
"\""
+
matchKey
+
"\""
+
"]"
+
", "
+
"null"
+
"]"
;
+
"\""
+
matchKey
+
"\""
+
"]"
+
", "
+
"null"
+
"]"
;
...
...
jvm/core/src/main/java/ml/dmlc/tvm/rpc/RPC.java
View file @
ddd249f2
...
@@ -32,6 +32,7 @@ public class RPC {
...
@@ -32,6 +32,7 @@ public class RPC {
public
class
TrackerCode
{
public
class
TrackerCode
{
public
static
final
int
PUT
=
3
;
public
static
final
int
PUT
=
3
;
public
static
final
int
UPDATE_INFO
=
5
;
public
static
final
int
GET_PENDING_MATCHKEYS
=
7
;
public
static
final
int
GET_PENDING_MATCHKEYS
=
7
;
public
static
final
int
SUCCESS
=
0
;
public
static
final
int
SUCCESS
=
0
;
}
}
...
...
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