Reputation: 20015
Now that Cloud Functions (Generation 2) can run for up to 60 minutes, how do I stop a running cloud function instance (a specific invocation of the GCF)?
For example, what if I'm running a complex workload in many GCF invocation instances, and I need to stop one worker (e.g. I no longer need the output from that job), how would I stop just that GCF invocation instance?
Cloud Functions have an labels.instanceId
value that appears in the logs. Is there an API to terminate an instance? The challenge here is that I can try listening for a kill signal (on a Pub/Sub subscription, or polling a GCS file, or listening to a Memorystore Redis Pub/Sub channel), but all of these won't scale well when running thousands of concurrent GCF instances that could potentially need killing.
It sure would be optimal if we could just tell the runtime (Cloud Run or Cloud Functions) to stop a specific running function invocation instance.
Upvotes: 0
Views: 4977
Reputation: 2065
As stated from the comments above, there's no option to stop a running Cloud Functions instance as it will only stop on error or success. A feature request was also suggested from the comments however we don't have a specific ETA for this.
Upvotes: 4