tableau / TabPy

Execute Python code on the fly and display results in Tableau visualizations:
https://tableau.github.io/TabPy/
MIT License
1.56k stars 598 forks source link

TabPy: Deploying endpoints in heroku #495

Closed fgall002salinas closed 2 years ago

fgall002salinas commented 3 years ago

Environment information:

Describe the issue Trying to deploy a basic model into my new instance of TabPy that I created in 'Heroku'. I'm trying to deploy the model locally into the server with the following code

from tabpy.tabpy_tools.client import Client
client = Client(HOST_HEROKU_SERVER)
client.set_credentials(Username, Password)
def add(x, y):
    import numpy as np
    return np.add(x, y).tolist()
client.deploy('add', add, 'Adds two numbers x and y', override=True)

I receive the following error

 File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/app'

try to run same block of code inside heroku cli and recieve the following error

tabpy.tabpy_tools.rest.ResponseError: (500) error adding endpoint FileNotFoundError : [Errno 2] No such file or directory: '/app/tabpy/tabpy_server/staging/endpoints/add/1'

where the file is visible when I navigate through the folder

I have the following configuration settings on my heroku instance

TABPY_QUERY_OBJECT_PATH = /app/tabpy/tabpy_server/tmp/query_objects
TABPY_PWD_FILE = /app/tabpy/tabpy_server/common/file.txt

Additional context Any help of how to correctly deploy models into a heroku instance is really appreciate it.

0golovatyi commented 3 years ago

@fgall002salinas Deploying functions on Heroku TabPy is not currently supported.

fgall002salinas commented 3 years ago

Hi @0golovatyi thank you for reaching out!

Is it possible to deploy the functions locally and migrate them to Heroku as a read only service.

I noticed that ones a function is deploy it gets saves on the query_objects folder. I tried to push the folder into my Heroku instance and access the file using:

TABPY_QUERY_OBJECT_PATH = /app/tabpy/tabpy_server/tmp/query_objects

However I still get that I have no functions presents in my Heroku instance. So I currently have a Tabpy application on Heroku without any functions to access.

dduran28 commented 3 years ago

@0golovatyi Any insights here? I am trying to achieve similar functionality of deploying functions on Heroku TabPy. Is there a work around?

dleskosky commented 2 years ago

@fgall002salinas I am not sure why the approach that you described didn't work. But in general, TabPy on Heroku doesn't currently support deployed functions. We will be sure to let the TabPy community know when we address this issue.