Error 500 trying to install plugin from Archive with API
Hello,
I'm in the process of automating a complete installation of DataIku. While I'm almost done, I'm struggling with plugins install. I'm unable to use the ansible collection or the python API as I keep getting an error 500 from the server when trying to install a plugin from a zip archive (installing the same plugin through the GUI works fine).
the (very simple script, based on the API documentation):
from pprint import pprint import dataikuapi client = dataikuapi.DSSClient("http://localhost:10000/", "*******") future = client.install_plugin_from_archive('dss-plugin-ab-test-calculator-1.0.1.zip') result = future.wait_for_result() pprint(result)
the error:
Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/dataikuapi/dssclient.py", line 1452, in _perform_http http_res.raise_for_status() File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Server Error for url: http://localhost:10000//dip/publicapi/plugins/actions/installFromZip During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 6, in <module> future = client.install_plugin_from_archive('dss-plugin-ab-test-calculator-1.0.1.zip') File "/usr/local/lib/python3.8/dist-packages/dataikuapi/dssclient.py", line 286, in install_plugin_from_archive self._perform_json("POST", "/plugins/actions/installFromZip", files=files) File "/usr/local/lib/python3.8/dist-packages/dataikuapi/dssclient.py", line 1468, in _perform_json return self._perform_http(method, path, params=params, body=body, files=files, stream=False, raw_body=raw_body).json() File "/usr/local/lib/python3.8/dist-packages/dataikuapi/dssclient.py", line 1459, in _perform_http raise DataikuException("%s: %s" % (ex.get("errorType", "Unknown error"), ex.get("detailedMessage", ex.get("message", "No message")))) dataikuapi.utils.DataikuException: java.lang.Exception: Could not install the plugin
From what I understand, the server is replying with error 500, as I don't have many option to try on client side, I have absolutly no idea what is wrong ...
any help would be appreciated.
tested on dataiku 12.6.3 with latest python API
Operating system used: Ubuntu 20.04
Best Answer
-
Sure, if you go in the documentation examples section, you can find related info on the method "install_plugin_from_archive" (here : Plugins - Dataiku Developer Guide )
In the API documentation, there is no mention of this method in the plugins section.
Finaly, in the dss_client.py code of the dataiku API, there is another method the "start_install_plugin_from_archve" who works with future and can be called with "wait_for_result"
as such, the code in the ansible collection goes from
if args.zip_file is not None: future = client.install_plugin_from_archive(args.zip_file)
to
if args.zip_file is not None: with open(args.zip_file,"rb") as f: future = client.start_install_plugin_from_archive(f)
with an updated local collection, it works
Answers
-
Hello,
You need to pass a FileObject to install_plugin_from_archive function as specified here:
https://developer.dataiku.com/latest/concepts-and-examples/plugins.html#from-a-zip-file
Best,
-
Hello,
thanks for your reply, figured that out, even if the example section does not correspond to the documentation ...
Had to use the file object as you said, and use the start_install_plugin_from_archive method (in order to get a result)
Also had to update the ansible galaxy module as it relies on the hold method and fails because of the "no wait for result method". -
Could you please give me the link to the example section that do not matches the documentation so we can update it?
Thanks for pointing the ansible galaxy module was not up to date. -
Oooooh I see, the method install_plugin_from_archive is documented in the DSSClient section, not in the plugin section as it is offered by DSSClient (here: https://developer.dataiku.com/latest/api-reference/python/client.html#dataikuapi.DSSClient.install_plugin_from_archive)
I've given the info about the issue in the galaxy module to the team responsible of it.
Thanks a lot
-
Hi,
We have integrated your fix to the galaxy module. It is already available in github and it will be available in FM in the next release.
Thanks for reporting!