Select to view content in your preferred language

What is the best way to convert my Python script into a web service?

616
2
10-23-2023 05:43 AM
Labels (3)
TZ
by
Emerging Contributor

I wrote a Python script which checks dependencies for all Items found in Portal for ArcGIS - pretty much using the same logic as provided in the official Esri tutorial.

The script works perfectly well and now I would like it to be usable by other ArcGIS Enterprise users (both admins and non-admins).

Initially I was thinking about setting up a separate domain name, like  myscript.com, but now i'm thinking maybe i could accommodate my script on the same server that is hosting Portal for ArcGIS and make it accessible via URL like gis.company.com/portal/myscript. Is it possible? Is there any guide for that?

I am using ArcGIS Enterprise v11.1

0 Kudos
2 Replies
EarlMedina
Esri Regular Contributor

When I think running scripts as a service, I think of either AWS Lambda or Azure Functions. If you have access to either of those, then you can set one up fairly easily. In that scenario, the users hit an endpoint, some processing happens, a result is returned (the result of your script).

Other options:

  • If you have access to ArcGIS Notebook Server, you can save your script as a Jupyter Notebook (.ipynb) and upload. From there, users can run through Portal via ArcGIS Notebook Server. If you don't have access to ArcGIS Notebook Server, then they will need to download the notebook and run locally.
    • You could set up your own Jupyter Notebook server and users can run the script(s) through there. 
  • You could upload the script as a text file (.py is not allowed) to your portal and share as an item. Then your users will have to download or copy/paste the code to execute.
MobiusSnake
MVP Regular Contributor

Since you're using Enterprise, maybe you could publish it as a GP service?