[DSE Graph Sandbox] Websocket support?

141 views
Skip to first unread message

Cecil New

unread,
Sep 20, 2016, 4:49:37 PM9/20/16
to Gremlin-users
I have a custom loader written in Go using the github.com/qasaur/gremgo driver. I wrote and tested using the Gremlin server. Is there any reason to expect this not to work with DSE Graph?

Thought I'd ask here before I start digging and debugging... or asking the driver author about it. thanks.

If interested, my output on both are below.



Inside the Datastax Sandbox it is hanging on loading the first node. Here is what I see in the VM:
[datastax@localhost bulkcsv]$ go run bulkcsv.go -i i2.csv -t q2.gremlin -h 127.0.0.1:8182 -debug=true -suppress=true
2016/09/20 13:28:53 WebSocket OK to:<127.0.0.1:8182>
2016/09/20 13:28:53 Template is:
graph.addVertex(label, "part", "name", PART)
2016/09/20 13:28:53 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 13:28:53 Bindings:<map[PART:P100]>

It will just hang here. 

If I use `bin/dse cassandra-stop` in another window, it will err out:
2016/09/20 13:46:17 websocket: close 1006 (abnormal closure): unexpected EOF
exit status 1
So it seems to connected, just not functioning. 


Here is what I see when run against Gremlin Server:
2016/09/20 16:27:34 WebSocket OK to:<127.0.0.1:8182>
2016/09/20 16:27:34 Template is:
graph.addVertex(label, "part", "name", PART)
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P100]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P200]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P210]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P220]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P300]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P310]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P320]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P330]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P340]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P350]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P500]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P600]>
2016/09/20 16:27:34 Query:<graph.addVertex(label, "part", "name", PART)>
2016/09/20 16:27:34 Bindings:<map[PART:P700]>
$

Stephen Mallette

unread,
Sep 20, 2016, 5:08:54 PM9/20/16
to Gremlin-users
I would think it should work - other drivers haven't needed any modification as best i can recall. DSE Graph does require you to pass an alias on the request, but I would expect it to yield you a nice error that says you forgot to do that. Perhaps gremlo is choking on that? 



--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/218715ce-ad16-4b87-bb45-f6f546f4c76a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cecil New

unread,
Sep 21, 2016, 7:20:41 AM9/21/16
to Gremlin-users
I had not considered that difference between Gremlin Server and DSE Graph. In the console, I only need to enter the alias once per "session": :remote config alias g pleff.g (where pleff is the graph name).

Do I need to do this once per WS connection? is the connection considered the start of a "session"?

Given that the ":remote" piece is for the console, I think the rest is what I need to send. Does the form needed from a driver differ from this form used by the console? In other words, does it need to take a form like this:
graph.context(...)?

I'll start looking for the answers... Thanks for your insights!
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.

Stephen Mallette

unread,
Sep 21, 2016, 7:35:10 AM9/21/16
to Gremlin-users
In the console, the alias can be set once from that perspective. from the perspective of the java driver sending the message, it sends that alias on every request. similarly, gremgo, should have similar functionality available to you, though, again, i'm not sure if that's your problem in this case.

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/cfa8f215-d3ee-4643-a036-6e304c6db068%40googlegroups.com.

Cecil New

unread,
Sep 21, 2016, 5:17:44 PM9/21/16
to Gremlin-users
After some digging, I still haven't found how a driver should set the alias. In DSE Graph documentation, such as (1), there is an assumption that the alias has already been set. In a stack overflow question (2), it is set in the console and the loader is invoked from the tool (meaning, I guess it is written in Groovy).

I plan to file an issue with the gremgo driver also about this.

And while it may not be the cause of the issue I am running into, it makes perfect sense that the alias must be set. So hoping for the best.


Cecil New

unread,
Sep 23, 2016, 3:56:27 PM9/23/16
to Gremlin-users
For posterity...
  • the issue was indeed the missing alias
  • the Go driver did not support the aliasing
  • I was able to patch the driver to get things working.
  • In the JSON payload, the alias is set using the name "rebindings", the key:value pair would be something like "g":"demo.g"
The JSON payload would look like this:
{
"requestId": "- this is UUID value",
"op": "eval",
"processor": "",
"args": {
"language": "gremlin-groovy",
"gremlin": "graph.addVertex(label, \"part\", \"name\", PART)",
"bindings": {
"PART":"P100x"
}
"rebindings": {
"g":"demo.g"
}
}
}


The entire serialized message goes like this:
Byte 1: the length of the mime-type (next), which is 16 decimal (10 hex).
Bytes 2-17: the string "application/json"
Bytes 18 to end: the JSON payload

Hope this helps someone else!
Reply all
Reply to author
Forward
0 new messages