Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1157

gremlin.sh should allow you to execute a script and go interactive on error or completion

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Implemented
    • Affects Version/s: 3.1.1-incubating
    • Fix Version/s: 3.2.1
    • Component/s: console
    • Labels:
      None

      Description

      This may be specific to my workflow, but generally when I am learning/experimenting with a REPL I have one window open with my script and another console open that I use to run it. I like to restart the REPL every time to avoid lingering state.

      I would like to be able to drop back to interactive executing a script once it completes and my data is loaded and any queries I may have run are complete and I can inspect the results.

      On error I want to drop to interactive so I can inspect the current state at the time the error occurred.

        Issue Links

          Activity

          Hide
          spmallette stephen mallette added a comment -

          Implemented on TINKERPOP-1268

          Show
          spmallette stephen mallette added a comment - Implemented on TINKERPOP-1268
          Hide
          spmallette stephen mallette added a comment -

          This issue is basically being implemented on TINKERPOP-1268

          Show
          spmallette stephen mallette added a comment - This issue is basically being implemented on TINKERPOP-1268
          Hide
          spmallette stephen mallette added a comment -

          You can currently do:

          $ bin/gremlin.sh init.groovy
          
                   \,,,/
                   (o o)
          -----oOOo-(3)-oOOo-----
          plugin activated: tinkerpop.server
          plugin activated: tinkerpop.utilities
          plugin activated: tinkerpop.tinkergraph
          ==>2
          ==>5
          Bad line in Gremlin initialization file at [z = x + y] - No such property: y for class: groovysh_evaluate
          

          where init.groovy contains:

          x = 1+1
          x + 3
          z = x + y
          z - 2
          

          but obviously that exits the console which is not what you want. I could see where we have room for improvement here as compared with groovysh and the link you provided. I'll look into this further. Thanks.

          Show
          spmallette stephen mallette added a comment - You can currently do: $ bin/gremlin.sh init.groovy \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph ==>2 ==>5 Bad line in Gremlin initialization file at [z = x + y] - No such property: y for class: groovysh_evaluate where init.groovy contains: x = 1+1 x + 3 z = x + y z - 2 but obviously that exits the console which is not what you want. I could see where we have room for improvement here as compared with groovysh and the link you provided. I'll look into this further. Thanks.
          Hide
          aweisberg Ariel Weisberg added a comment -

          If you start gremlin.sh and pass it as a parameter a file to execute I would like it to stop upon reaching the first parse error or uncaught exception and become an interactive shell so I can inspect the state of the program.

          Something like python -i

               When  a  script  is  passed as first argument or the -c option is used, enter interactive mode after executing the script or the command.  It does not read the
               $PYTHONSTARTUP file.  This can be useful to inspect global variables or a stack trace when a script raises an exception.
          

          Maybe something does exist for groovy 2.4?

          Show
          aweisberg Ariel Weisberg added a comment - If you start gremlin.sh and pass it as a parameter a file to execute I would like it to stop upon reaching the first parse error or uncaught exception and become an interactive shell so I can inspect the state of the program. Something like python -i When a script is passed as first argument or the -c option is used, enter interactive mode after executing the script or the command. It does not read the $PYTHONSTARTUP file. This can be useful to inspect global variables or a stack trace when a script raises an exception. Maybe something does exist for groovy 2.4?
          Hide
          spmallette stephen mallette added a comment -

          I'm not sure I follow exactly what you're asking for here with respect to the console being "interactive". The term "interactive" has a specific meaning for Groovy Shell, the basis for TinkerPop's Gremlin Console. Is this something that can be done with the standard Groovy Shell? If not, it may not be possible in general from TinkerPop's perspective...it would likely mean work for Apache Groovy.

          Show
          spmallette stephen mallette added a comment - I'm not sure I follow exactly what you're asking for here with respect to the console being "interactive". The term "interactive" has a specific meaning for Groovy Shell, the basis for TinkerPop's Gremlin Console. Is this something that can be done with the standard Groovy Shell? If not, it may not be possible in general from TinkerPop's perspective...it would likely mean work for Apache Groovy.

            People

            • Assignee:
              spmallette stephen mallette
              Reporter:
              aweisberg Ariel Weisberg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development