ONTAP Rest API Discussions

Python 'with' context manager and rest apis multi threading

RobertSimac
357 Views

I do have slight suspicion, based on some observed problems, the ontap rest api python recommended use of 'with host_connection:' may run into problems when called from two separate threads, against two separate hosts...

 

Namely, there is an 'global _HOST_CONTEXT_' variable set right at the HostConnection.__enter__() method, which re-sets the global host context for the 'duration' of such 'with' context. (netapp_ontap\host_connection.py)

 

If other thread executes the same 'with host_connection:' statement against other host, it may disturb whatever the first thread is doing within its'  'with restconn:' scope...

 

I was not able to find anything in current documentation regarding multi threading, thus the question here if anyone experienced any issues in that area.

 

thanks

0 REPLIES 0
Public