Accessing Dataiku APIs on containerized execution

anuraa02
Level 1
Accessing Dataiku APIs on containerized execution

Hi team,

I'm facing an issue trying while reading details of Dataiku Visual Model using Python code which is a part of a webapp. I am using container for backend processing.

I am calling the model using dataiku.Model() method which working perfectly however, I am facing issues when trying to use the get_predictor() function to fetch some details related to the model. I'm getting file not found error. 

If I run the webapp using local execution then it seems to work just fine. The issue raises only when the webapp runs on a container. So my hypothesis is that when running on a container, the backend is unable to reference to a relative path (app/dataiku/dss.....) where model details are stored. 

Error logs attached for reference:

File "/opt/dataiku/python/dataiku/core/saved_model.py", line 202, in get_predictor
self._predictors[version_id] = build_predictor_for_saved_model(model_folder, self.get_type(), sm.get("conditionalOutputs", []))
File "/opt/dataiku/python/dataiku/core/saved_model.py", line 268, in build_predictor_for_saved_model
core_params = dkujson.load_from_filepath(osp.join(model_folder, "core_params.json"))
File "/opt/dataiku/python/dataiku/core/dkujson.py", line 36, in load_from_filepath
with open(filepath) as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/app/dataiku/DSS_DATA_DIR/saved_models/<PROJECTKEY>/<modelid>/versions/initial/core_params.json'
0 Kudos
1 Reply
fchataigner2
Dataiker
Dataiker

Hi,

the `get_predictor()` isn't compatible with containerized execution, because it accesses the model files directly. You need to either run the webapp on local execution, or setup an API node to run the model on and call the model over HTTP.

0 Kudos
A banner prompting to get Dataiku DSS
Public