afaik the autoscaler(proxy) works based on network traffic, and long running processes inside your vms are invisible to the autoscaler, which is why your vm is being shutdown.
Here’s what I think you can do.
- You can disable scale-to-zero and update your application to shut down the VM when it’s done running.
- Then, you can delegate the starting of your application to the autoscaler, by setting the
auto_start_machines = true
You can find more on autostart and autostop here