<@ULVA73B9P> I have Windows VMs that host Prefect ...
# ask-marvin
k
@Marvin I have Windows VMs that host Prefect workers. They are currently Windows 11 (64-bit) and my IT department is asking me if they can move them to Server 2025. What concerns/issues should I be aware of?
m
thought for 137.4 seconds
Short answer: moving Prefect workers from Windows 11 to Windows Server 2025 should generally be fine, but I’d pay close attention to how the worker is run on the VM. The biggest concerns are less about “Windows 11 vs Server 2025” and more about Windows desktop vs Windows server/service behavior. Main things to watch 1. Run workers as a proper service - On Windows Server, interactive user sessions are less common, so signal/shutdown behavior can differ. - Prefect uses Windows-specific process handling and relies on Windows console/process-group behavior for graceful stopping. - If your worker is currently launched from a logged-in desktop session, that can behave differently once moved to Server 2025. - Prefect’s Windows guidance recommends using NSSM for running services on Windows. - Docs: Run Prefect on Windows 2. Graceful shutdown / cancellation behavior on Windows - Windows is already different from Linux/macOS here. - Prefect uses
CTRL_BREAK_EVENT
/ Windows process-group semantics instead of Unix signals. - Some cancellation/timeout mechanisms are more limited on Windows in general, and that does not change between Windows 11 and Server 2025. - So if you have flows that depend on very Unix-like signal behavior, test them. 3. Service account / permissions - If the worker runs as a service account on Server 2025, verify it has access to: - your Prefect profile/config - Python install / venv - working directories - network shares / UNC paths - secrets/env vars - This is a common migration issue when something worked under a human login on Windows 11. 4. Paths and network shares - Prefect supports Windows paths and UNC paths, but you should still validate: -
PREFECT_HOME
- deployment working directories - mapped drives vs UNC paths - Important: mapped drives available in an interactive user session may not exist for a Windows service. Prefer UNC paths like
\\server\share\...
. 5. Python/runtime compatibility - Prefect 3.x supports modern Python versions on Windows. - Make sure your Server 2025 image uses a supported Python version and that any worker dependencies install cleanly there. 6. AV / Defender - Windows Defender or endpoint protection can slow worker startup and task execution, especially if it scans: - Python envs - temp directories -
.prefect
directories - Recheck exclusions after the OS migration. 7. If you use Docker workers - This is worth separate testing. - Docker behavior on Windows Server can be materially different from Windows 11, depending on whether you use Linux containers, Windows containers, or Docker Desktop equivalents. - If your current workers are just process workers, migration risk is lower. What I would test before approving the move Run a small validation on one Server 2025 VM: - start the worker as the intended production service - trigger a simple deployment - trigger a deployment that uses: - env vars - filesystem access - network share access - subprocesses - stop/restart the worker service and confirm runs are handled cleanly - if you use timeouts/cancellation, test cancelling a run explicitly Risk summary - Low risk: basic Prefect process workers running Python code locally - Medium risk: workers depending on interactive logins, mapped drives, or custom subprocess behavior - Higher risk: Docker-on-Windows setups or anything relying on graceful Unix-like signal handling My recommendation If your workers are standard Prefect 3 process workers, running on Python in a venv, and you move them to Server 2025 as a proper Windows service, I would expect this to work.
The main thing I’d avoid is assuming that a worker launched under a logged-in Windows 11 desktop user will behave the same when converted into a headless Windows Server service. Useful links: - Run Prefect on Windows - Workers concept docs If you want, I can also give you a specific pre-migration test checklist for Windows Server 2025 workers.
k
@Marvin Since we're already changing OS, should we consider Linux? What are the pros/cons of Linux vs. Windows when it comes to running Prefect workers?
m
thought for 130.6 seconds
Yes — if you’re already making an OS change, it is absolutely worth considering Linux for Prefect workers. For most teams, Linux is the better default platform for running Prefect workers. Windows is still viable, but usually best when you need Windows for the workloads themselves. Bottom line - Choose Linux if these are general-purpose Prefect workers. - Choose Windows only if the flows need Windows-specific tools, PowerShell, SMB/AD-native behavior, Windows-only drivers, or other OS-specific dependencies. Why Linux is usually better for Prefect workers 1. Better process and signal handling - Prefect workers launch and manage subprocesses. - On Linux, process groups and signals like `SIGTERM`/`SIGKILL` behave in the standard Unix way. - On Windows, Prefect has to use workarounds like
CTRL_BREAK_EVENT
, and cancellation/shutdown behavior is inherently less clean. - This matters when: - stopping workers - cancelling flow runs - cleaning up child processes - handling hung jobs 2. Simpler service management - Linux has systemd, which is a much nicer native way to run long-lived workers. - Windows usually needs more ceremony, often using tools like NSSM. - With Linux, auto-restart, boot-time startup, logs, environment config, and service health are all more straightforward. 3. Better fit for containers and Kubernetes - If you might ever move to Docker workers, Kubernetes workers, or containerized deployments, Linux is the natural choice. - Linux container support is much more mature and lighter-weight. - Windows containers are possible, but they’re usually heavier and more operationally awkward. 4. Fewer OS-specific edge cases - Linux generally avoids: - PowerShell execution policy issues - Windows path quirks - drive-letter vs UNC complications - text encoding surprises - antivirus/Defender interference patterns - In practice, Linux tends to be more predictable for worker infrastructure. 5. Better observability and debugging -
journalctl
, process tools, package managers, shell tooling, and common monitoring integrations are all strong on Linux. - It’s easier to inspect logs, processes, ports, open files, and system resource issues. Why you might stay on Windows Windows can still be the right answer if your flows do things like: - run PowerShell scripts - call Windows-only executables - depend on .NET tooling installed on Windows - need direct access to Windows-authenticated SMB shares - use drivers/ODBC setups that your org already standardizes on for Windows - depend on enterprise controls tied tightly to AD/GPO/Windows endpoint management If that’s your world, Windows workers are perfectly reasonable — just more operationally finicky. Practical pros/cons Linux pros - cleaner signal/cancellation behavior - easier background service management with
systemd
- better Docker/Kubernetes story - fewer worker shutdown/process cleanup issues - easier logging/monitoring - usually lower overhead and faster process startup Linux cons - may require your team to support another OS - access to Windows-native resources may need extra setup - some enterprise tooling may be less standardized there Windows pros - familiar to Windows-centric IT teams - easy fit for Windows-native scripts/apps - native integration with AD/SMB/Windows tooling - good option when the workload itself is Windows-specific Windows cons - less elegant process/signal behavior - more care needed for services - more path/encoding/session quirks - weaker container story - generally more operational gotchas for long-running worker hosts My recommendation If these workers are just doing “normal Python orchestration work”: - switch to Linux If these workers exist mainly to run Windows-native jobs: - keep a Windows worker pool, but consider moving everything else to Linux. A lot of teams end up with a hybrid model:
- Linux workers for most flows - Windows workers only for Windows-specific deployments That maps very naturally to Prefect work pools. Relevant docs: - Workers - Run Prefect on Windows If you want, I can also give you: 1. a decision checklist for Linux vs Windows, or 2. a sample Linux systemd setup for a Prefect worker.