python-etcd3 icon indicating copy to clipboard operation
python-etcd3 copied to clipboard

How to "keep-alive" by lease_id?

Open petrasl1976 opened this issue 1 year ago • 1 comments

Hi,

I am trying to find a way how can i extend TTL for lease by having its id only (not a whole object)? Lets say i have a script which will create lease:

import etcd3
etcd = etcd3.client()
etcd.lease(50, lease_id=123)

And i have another script which i like to refresh the leases only, without [re]creating it:

import etcd3
etcd = etcd3.client()
etcd.refresh_lease(lease_id=123) # or smth

Similar functionality like etcdctl has, so i can run keep-alive independently from another script:

# etcdctl lease grant 60
lease 42d78d9df80a26ab granted with TTL(60s)
# etcdctl lease keep-alive 42d78d9df80a26ab --once
lease 42d78d9df80a26ab keepalived with TTL(60)

Is there a way with etcd3 module extend lease when it is already created by another process or script ?

Thanks

petrasl1976 avatar Feb 13 '24 07:02 petrasl1976