How to run and debug Janus inside IntelliJ or other IDE?

376 views
Skip to first unread message

Augusto Will

unread,
Nov 2, 2017, 6:41:05 AM11/2/17
to Gremlin-users
Hi, I open de Janus project inside IntellyJ, i like to run the server inside the IDE,

1) if possible with my Lucene + Berkeley configuration to access my data? How can i do that? Or any other way if not possible.

2) I can't understand Gremlin in anyway, will be awesome if I can see more deeply what happens and what types Janus is returning, objetc constructors... what functions and types I can call in next chain while I see the source code.

3) About the Groovy things, how can I debug the code with breakpoints and create my own scripts? The groovy script can run and debugged outsite of a janus server debug (but inside will be better, i think...) How it works?

4) Janus process the results as stream? For example, for now, until i can understand gremlin (someday i will master this thing), but, for now, can I process my queries more in Java than Gremlin, is it possible? For example:

put the result of query in array: g.V(41123).out('friends')
make a loop in result and do some filter (in pure Java) get all the the other vertices by id and build an nested array with I need, mixing gremlin and Java, its possible? have too much performance loss?

5) is possible to make another g.V().something inside this script using the same connection "like session"?

What I really need help is how to debug inside IntelliJ and debug the results of my queries (with preference inside Janus server in debugger)
Thank you.

Stephen Mallette

unread,
Nov 2, 2017, 7:04:17 AM11/2/17
to Gremlin-users
IntelliJ should work for all the debugging scenarios you describe here. The trick is to know what to debug and where to breakpoint your code for it to be useful to you. Depending on your development environment this may be as simple as running a unit test with some Gremlin and adding a breakpoint in the unit test or it may be as complex as attaching Intellij to a running server or gremlin console. I'd offer the advice that you vastly simplify your environment until you get better control of Gremlin and the Java ecosystem. Create a simple project with maven - perhaps using the TinkerPop maven archetypes:


basically run this command:

mvn archetype:generate -DarchetypeGroupId=org.apache.tinkerpop -DarchetypeArtifactId=gremlin-archetype-tinkergraph -DarchetypeVersion=3.3.0 -DgroupId=com.my -DartifactId=app -Dversion=0.1 -DinteractiveMode=false

it will auto generate a basic starter project with maven that you can easily import into Intellij. Add a breakpoint in AppTest.java and run the debugger, then step through the code. Once that works, change the code up to be more specific to your domain. Write Gremlin that is matches the kind of Gremlin you expect to see in your system. Then, once you feel completely comfortable with that, swap out JanusGraph for TinkerGraph - all you do is change the pom.xml file to include the maven coordinates for JanusGraph and then remove the TinkerGraph.open() code in exchange for the JanusGraph initializer. Then run your debugger with that for a while. These smaller steps will help you get better acquainted with the basics and will thus allow you to ask more specific and advanced questions around more complex debugging scenarios and environmental setups (like remote debugging groovy scripts in Gremlin Server for example).

HTH,

Stephen




--
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/ab8acac3-95cc-420b-99d0-17be249d80fb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages