lazarillo commented on issue #29440:
URL: https://github.com/apache/beam/issues/29440#issuecomment-1898476710

   Yes, I understand that I can do it the way that you all mention.  But there 
are two problems:
   
   1. Context managers are "the Pythonic way" because as users, we assume that 
`__enter__()` and `__exit()__` are doing useful, hidden things that should be 
best practices.  For instance, file or DB connection handles are gracefully and 
automatically closed, no matter what happens within the manager.
   2. There is _no documentation anywhere_, at least nowhere that I could find, 
that explicitly states that one should not use the context manager when working 
with streaming jobs.  I just discovered this after some hunting + guessing.  
Minimally, there should be some documentation stating that a context manager 
cannot/should not be used for streaming.
       - I don't have evidence, but I would _expect_ that a lot of Apache Beam 
users are using it for streaming purposes.  Otherwise, we can just use Spark, 
which has been around longer, also has good documentation, and has a wider base 
of users with experience on the platform.
   
   I also wonder, what is the purpose of using the context manager, if the 
`__enter__()` and `__exit__()` are not needed?  Or if they are needed, then why 
isn't a context manager supported for streaming?
   
   I doubt I have the expertise to help with the implementation, but if you 
would like me to work on documentation stating that context managers should not 
be used for streaming, I can do that.  I would just like some promise / 
confidence that the PR I create would be merged in (assuming it's good).


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