[ 
https://issues.apache.org/jira/browse/TINKERPOP-2555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17456442#comment-17456442
 ] 

ASF GitHub Bot commented on TINKERPOP-2555:
-------------------------------------------

spmallette commented on a change in pull request #1515:
URL: https://github.com/apache/tinkerpop/pull/1515#discussion_r765787278



##########
File path: gremlin-python/src/main/python/gremlin_python/driver/client.py
##########
@@ -129,24 +123,28 @@ def _get_connection(self):
             headers=self._headers)
 
     def submit(self, message, bindings=None, request_options=None):
-        return self.submitAsync(message, bindings=bindings, 
request_options=request_options).result()
+        return self.submit_async(message, bindings=bindings, 
request_options=request_options).result()
 
-    def submitAsync(self, message, bindings=None, request_options=None):
+    def submit_async(self, message, bindings=None, request_options=None):
+        logging.debug("message '%s'", str(message))
+        args = {'gremlin': message, 'aliases': {'g': self._traversal_source}}
+        processor = ''
+        op = 'eval'
         if isinstance(message, traversal.Bytecode):
-            message = request.RequestMessage(
-                processor='traversal', op='bytecode',
-                args={'gremlin': message,
-                      'aliases': {'g': self._traversal_source}})
-        elif isinstance(message, str):
-            message = request.RequestMessage(
-                processor='', op='eval',
-                args={'gremlin': message,
-                      'aliases': {'g': self._traversal_source}})
-            if bindings:
-                message.args.update({'bindings': bindings})
-            if self._sessionEnabled:
-                message = message._replace(processor='session')
-                message.args.update({'session': self._session})
+            op = 'bytecode'
+            processor = 'traversal'
+
+        if isinstance(message, str) and bindings:
+            args['bindings'] = bindings
+
+        if self._session_enabled:
+            args['session'] = str(self._session)
+            processor = 'session'
+
+        if isinstance(message, traversal.Bytecode) or isinstance(message, str):
+            logging.info("processor='%s', op='%s', args='%s'", str(processor), 
str(op), str(args))

Review comment:
       i didnt give much thought yet to the logging messages. perhaps i'll do 
that on the next pass of this PR, but should we think about each of these log 
messages and whether or not they will make too much noise? e.g. "info" for this 
one seems like it would be a bit loud maybe at an `info` level? 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


> Support for remote transactions in Python
> -----------------------------------------
>
>                 Key: TINKERPOP-2555
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2555
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: python
>    Affects Versions: 3.5.0
>            Reporter: Stephen Mallette
>            Priority: Major
>
> TINKERPOP-2537 introduced remote transactions with {{g.tx()}} for use with 
> Java. The same functionality should be made available in Python.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to