Schedule Python scripts in Portal

02-12-2020 04:45 PM
Occasional Contributor

Is it possible to somehow schedule Python scripts in Portal? Currently I have a sever that runs a bunch of Python scripts on task scheduler and it would be nice to offload all this to Portal.



Occasional Contributor III

HeyIgor Balotsky,

At the moment task scheduler is the way to go for running python scripts. I haven't seen or heard anything suggesting that Portal will have that functionality.



If this answer has helpful please mark it as helpful. If this answer solved your question please mark it as the answer to help others who have the same question.

Occasional Contributor III

I'm guessing that what you mean is that you are trying to run the scripts somehow inside of the Portal environment?

For example, if there were a Portal Task Scheduler?

I'm also guessing that your Portal server is standalone Portal?

That you don't have a Base Enterprise deployment?Build a Windows Base Enterprise Deployment

All of my deployments have always been Base so I've always had access to AGS (ArcGIS Server) on the box.

And that allows me to just duplicate what you do, use Task Scheduler to set up and run my Python scripts when and where I want.

I don't see why you couldn't just do the same thing on a standalone Portal, but it's been 5 years since I stood that up and I don't recall what Python gets installed with that. But you could always install a standalone Python environment (I mean an Esri one that has arcpy embedded, etc...) Or at least, it used to be you could that. There were stand alone Python installers. I'm not sure those are still available but you could always install ArcPRO on the box or ArcMap depending on 64 or 32 bit code and py3 or 2.7

I would think it would be real simple to install the python you want and run you scripts just like did on AGS via Task Scheduler (again, I've made an assumption, that you're in Windows and not the Linux world.)

I remember now that I did this on a stand alone windows server to get access to Python3 and Panda, etc... and this was running an old 10.1 AGS (not in use, just sitting there running.)

I found some notes on that, it wasn't trivial. I had to hunt around for Python3 install stuff on a base box.

My sketchy notes were:

# I managed to run python3.x scripts on an all in one Portal, AGS, Data Store at 10.6.0) by:
# I found the Python3 installation folders on that server by seeking out the ArcPro batch files.
# I had a clue that Python3 was available in an AGS VM due to a GIS StackExchange thread and comment from Kevin Hibma:
# Kevin pointed us in a general direction for Python3 folder.
# I then found the ArcPro scripts in: C:\Program Files\ArcGIS\Server\framework\runtime\ArcGIS\bin\Python\Scripts
# within that folder are (5) batch files: activate.bat, deactivate.bat, proenv.bat, propy.bat, proswap.bat
# clearly they're related to setting up an external environment for Python3 so that scripts developed in ArcPro

# can be run as stand alone, external scripts.

# BUT, the scripts themselves are not documented so it's tricky figuring out which to run, in what order, etc...

and it appears I didn't document the trickiness solution - sorry, I imagine I was off and running getting the scripts to run from task scheduler and that was the end of that documentation.

Don't know if this help but good luck with it.