Options for Scheduling Python Scripts on Remote Machines
Summary
The discussion considers ways to run automated Python tasks away from a personal computer. It suggests retaining the operating system's task scheduler when the number of scripts remains manageable, or using a Python scheduler to trigger jobs from within a program. For portability, scripts can be copied to a local or cloud server, or packaged with their environment in Docker containers so they can run across machines with compatible Docker support.
A separate answer mentions Linux cron as an alternative, including through the Windows Subsystem for Linux. These are practical deployment suggestions rather than a detailed comparison or setup guide. The document does not cover monitoring, failure recovery, security, scaling, or cost, and it offers no benchmarks showing which approach is best for a particular workload.
Key ideas
- A desktop task scheduler can remain adequate for a manageable collection of automated scripts.
- A Python scheduling library can trigger tasks from within a program.
- Docker packages scripts and their runtime environment to support portability across machines.
- Cron is another scheduling option for users working in a Linux environment.
Tags
Full text
# Running scripts outside of desktop # Running scripts outside of desktop In the company I work for, I use several Python scripts that automate many tasks. However, this happens via the task scheduler. I would like to ask you what solutions are you using that make this possible, outside my machine. Do you use a Virtual Machine? Are your scripts dockerized on Kubernetes? (sorry, don't understand much of the subject). What was are there to run tasks automatically outside ones PC? Thank you. ## Answer by matt (score 1, accepted) https://quant.stackexchange.com/a/70007 My own opinion: if your scripts are still of a manageable number, then using the Task Scheduler is not a bad option. Alternatively, since you are using Python, you can use the APScheduler library to trigger scripts in-code. I'm assuming you're looking at portability since you asked about running scripts outside your machine. One option is of course to copy-paste your codes to a remote server (can be local or cloud). With Docker, you can basically "bundle" your scripts (see docker-compose). The sweet thing is that you are (almost) guaranteed portability, in the sense that you have the same running environment across all machines (assuming the same Docker version; there are also some nuances with OS compatibility). Then, you can package these scripts into "images" which can be run as "containers" on any machine. ## Answer by Dimitri Vulis (score 1) https://quant.stackexchange.com/a/70003 It sounds like the Windows Task Scheduler is quite adequate for your needs. But if you prefer a more linux-y solution, you can download WSL https://docs.microsoft.com/en-us/windows/wsl/install + https://ubuntu.com/wsl and use `cron`.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.