Connecting remotely from python to graph that was created via ConfiguredGraphFactory

189 views
Skip to first unread message

Jozsef Szalay

unread,
May 18, 2018, 4:08:31 PM5/18/18
to JanusGraph users
Hi,

I'm currently evaluating Janusgraph. I'm new to the platform. I have run into a problem while trying to connect to a graph from python.

I'm using the gremlin-server with the Cassandra backend and Elasticsearch as the index provider.

I was able to start up the server, and I could connect to it remotely via the gremlin console. From the console, I was able to create and later open multiple graphs in the same Janusgraph instance by using ConfiguredGraphFactory. Please note that I have not updated the "graphs" section of the "conf/gremlin-server/gremlin-server-configuration.yaml" file with the dynamically created graphs. Yet, I was able to access my graphs even after restarting both the server and the console. 

So, everything seems to work fine from the gremlin console. What I need is to do the same from python. I need to be able to create/open/traverse/close/delete multiple graphs from python targeting the same remote Janusgraph instance/cluster. How can I access the functionality provided by ConfiguredGraphFactory from python? I'm currently using the gremlin-python client, but I'm not married to it. Thanks for the help!

David Pitera

unread,
May 18, 2018, 9:26:13 PM5/18/18
to Jozsef Szalay, JanusGraph users
I believe that the gremlin-python client assumes you are going to access existing graph/traversal references, something like "graph" or "g". However, if you want to dynamically access your graphs, then they might not yet be bound on the server.

If you are using JG 0.2.x, then graphs created on the server will not automatically bind graph references and traversal references to all the JG executors upon graph creation using the CGF. However, if you are willing to use JG master (build the dist yourself) or wait for 0.3.x (should be soon), then the graph references and traversal references will be bound automatically: see https://github.com/JanusGraph/janusgraph/pull/884 and https://github.com/JanusGraph/janusgraph/pull/953

Now, this would mean that you would have to successfully issue a CGF#create (if u use a template config) or CGF#open at least once for the binding to occur; if the python module expects your references to already be bound, but executes anyway, then you might be able to use it. Otherwise, use a lower level http library to handle your graph creations, and then wait 20s, and then the reference should be bound and you can use the gremlin-python module as it currently exists wanting you to pass in the graph/traversal reference when you submit a command.

--
You received this message because you are subscribed to the Google Groups "JanusGraph users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to janusgraph-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/janusgraph-users/7f63462f-5631-4d30-afd1-5973618bf2d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages