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'
Answers
-
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.
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 Dataiker
@anuraa02
get_predictor is compatible with containerized execution starting with DSS 12.3.0
https://doc.dataiku.com/dss/latest/release_notes/12.html#machine-learning