prmoore77 commented on issue #36844:
URL: https://github.com/apache/arrow/issues/36844#issuecomment-1781677201

   FWIW - thanks to @delta003 's comment - we had success with using a 
decorator function:
   
   ```
   import functools
   
   def debuggable(func):
       """A decorator to enable GUI (i.e. PyCharm) debugging in the
          decorated Arrow Flight RPC Server function.
   
          See: https://github.com/apache/arrow/issues/36844
          for more details...
       """
   
       @functools.wraps(func)
       def wrapper_decorator(*args, **kwargs):
           try:
               import pydevd
               pydevd.connected = True
               pydevd.settrace(suspend=False)
           except ImportError:
               # Not running in debugger
               pass
           value = func(*args, **kwargs)
           return value
   
       return wrapper_decorator
       
       
   class FlightServer(pyarrow.flight.FlightServerBase):
   
       @debuggable
       def get_flight_info(self, context: pyarrow.flight.ServerCallContext, 
descriptor: pyarrow.flight.FlightDescriptor) -> pyarrow.flight.FlightInfo:
           do_stuff()
   
       @debuggable
       def do_get(self, context: pyarrow.flight.ServerCallContext, ticket: 
pyarrow.flight.Ticket) -> pyarrow.flight.FlightDataStream:
           do_stuff()
   ```
   
   This seemed to work great for us - we hope this helps some folks facing the 
same issue until it works OOTB.


-- 
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]

Reply via email to