Cross OS client.deploy() fails due to OS specific path issues
See original GitHub issueIf you deploy from a Windows tabpy client to a Linux tabpy server the deploy will fail. This seems due to the fact that the client constructs part of the destination path on the client platform then concatenates that path part to a server path resulting in a path of the form /bla/bla\bla\bla this is not a valid Linux path.
Here is an example:
` def ztest(p1, p2, n1, n2): import math def zstat(p1, p2, n1, n2): p1 = float(p1) try: return (p1 - p2) / math.sqrt((p1 * (1 - p1))/n1 + (p2 * (1 - p2))/n2) except TypeError: # handle the first value where p2, n2 return as None return 0 return [zstat(p1, p2, n1, n2) for (p1, p2, n1, n2) in zip(p1, p2, n1, n2)]
client = tabpy_client.Client(‘http://tabpyserver:9004/’) client.deploy(‘ztest’, ztest, ‘ztest for tabPy Demo’) ` The error is:
WARNING:tabpy_client.query_object:Overwriting existing file '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\endpoints\ztest\1' when saving query object ERROR:tabpy_client.rest:Error with server response. code=500; text={"info": "Error when /add_endpoint: Traceback\n Traceback (most recent call last):\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 307, in post\n err_msg = yield self._add_or_update_endpoint('add', name, 1, request_data)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py\", line 232, in result\n raise_exc_info(self._exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1014, in run\n yielded = self.gen.throw(*exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 185, in _add_or_update_endpoint\n yield self._copy_po_future(src_path, target_path)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/concurrent.py\", line 232, in result\n raise_exc_info(self._exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1014, in run\n yielded = self.gen.throw(*exc_info)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 231, in _copy_po_future\n ret = yield future\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tornado/gen.py\", line 1008, in run\n value = future.result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 400, in result\n return self.__get_result()\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_base.py\", line 359, in __get_result\n reraise(self._exception, self._traceback)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/_compat.py\", line 107, in reraise\n exec('raise exc_type, exc_value, traceback', {}, locals_)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/concurrent/futures/thread.py\", line 61, in run\n result = self.fn(*self.args, **self.kwargs)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/tabpy.py\", line 59, in copy_from_local\n shutil.copytree(localpath, remotepath)\n File \"/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/shutil.py\", line 171, in copytree\n names = os.listdir(src)\nOSError: [Errno 2] No such file or directory: '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\\\\endpoints\\\\ztest\\\\1'\n\nError type : OSError\nError message : [Errno 2] No such file or directory: '/home/ubuntu/anaconda/envs/Tableau-Python-Server/lib/python2.7/site-packages/tabpy_server/staging\\\\endpoints\\\\ztest\\\\1'\n", "message": "error adding endpoint"}
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (1 by maintainers)
I still run into this issue in 2020, with TabPy client saving the deployed function into its own container’s local path and TabPy server attempting to find the function it is own container (which results in error 500).
The only solution indeed seems to be - as suggested by @jstrauss18 to expose the shared location (in our case: persistent volume claim) that both client and server containers can see. Since the volume will be in the same Openshift namespace, the functions and other pickles will be exposed only to a single user running both client and server containers in the same namespace (so no security problems here).
Edit: I can confirm that it worked (client-server file exchange via shared storage), but
tabpy
was unable to create a folder in which it tries to initialize its .ini file… surely not ensuring the folder exists before creating the .ini file is a bit of a bug. So the .ini file had to be manually created first in the shared location and then deploying functions to “remote” tabpy server from jupyter notebook started to work.Looks to be the same underlying issue as #35. TabPy client can currently only deploy when it is being run on the same machine is TabPy Server - You cannot publish from one client machine to a different server machine.