pulumi/pkg/util
Thomas Gummerer 0626aa3261
try to prevent systems from going to sleep during pulumi operations (#17675)
Most operations that pulumi does are long running operations.  At the
same time modern computers have sometimes pretty agressive power
saving methods.  These are however not great while a pulumi operation
is running, as interrupting an operation in the middle can lead to
half set up resources, and leases timing out.

In particular we have a lease with the pulumi service that needs to be
renewed quicker than every 5 minutes.  If the computer running the
update goes to sleep, cloud infrastructure might get set up, but never
stored in the state (see https://github.com/pulumi/pulumi/issues/7094).

We can help the users here and make a best effort to prevent the
system from going to sleep.  Various operating systems have different
APIs for this.  Unfortunately I couldn't find a package that wraps
this neatly, so I implemented this taking inspiration from the wakepy
python package:
https://wakepy.readthedocs.io/stable/methods-reference.html#wakepy-methods.

We ignore all errors in setting up this power management, since it may
not be available in some environments, but pulumi will continue
functioning (mostly) correctly no matter if this is set up or not.

For now this is only implemented for updates going through the cloud
backend, though there's nothing preventing us from extending it to the
DIY backend as well.

Hopefully fixes https://github.com/pulumi/pulumi/issues/7094 in
conjunction with https://github.com/pulumi/pulumi/pull/17519

Addresses part of https://github.com/pulumi/pulumi/issues/10279
2024-11-05 19:08:59 +00:00
..
afero Fix convert pcl copy 2023-04-14 22:04:50 +01:00
cancel all: Assert => Assertf 2023-03-03 14:37:43 -08:00
gsync Use a generic wrapper around `sync.Map` (#15878) 2024-04-09 10:56:25 +00:00
nosleep try to prevent systems from going to sleep during pulumi operations (#17675) 2024-11-05 19:08:59 +00:00
rpcdebug Remove deprecated Protobufs imports (#15158) 2024-01-17 09:35:20 +00:00
testutil all: Drop ioutil 2023-01-06 16:35:14 -08:00
tracing Prepare golangci-lint upgrade (#17065) 2024-08-28 07:57:38 +00:00
validation Enable goheader rule and add missing license headers (#15473) 2024-09-09 12:05:45 +00:00
plugin.go [cli/plugin] Fix plugin install command when plugin type is tool (#16407) 2024-06-17 13:25:57 +00:00
plugin_test.go Refactor: move plugin kind to apitype (#15946) 2024-04-25 17:30:30 +00:00