- This topic has 3 replies, 3 voices, and was last updated 1 year, 6 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The topic ‘How to extend the lease end date?’ is closed to new replies.
Home › Forums › FABRIC General Questions and Discussion › How to extend the lease end date?
Tagged: extend lease
Dear Community,
I created my slice and it is automatically deleted after 24 hours.
How can I extend my slice lease end date? My slice id is : 3eb74e73-9105-4e37-9e89-251f18e31f49
Kind regards,
Nagmat
Hi, You can use the following code to extend your lease:
from datetime import datetime
from datetime import timezone
from datetime import timedelta
#Set end host to now plus 1 day
end_date = (datetime.now(timezone.utc) + timedelta(days=1)).strftime("%Y-%m-%d %H:%M:%S %z")
try:
slice = fablib.get_slice(name=slice_name)
slice.renew(end_date)
except Exception as e:
print(f"Exception: {e}")
Note that a great place to learn about FABlib is in the JupyterExample that come pre-installed in your JupyterHub container. You can also pull the examples from github
Current examples in a zip file (FABRIC Jupyter Examples 1.4.2)
The index of other example can be found here: (Jupyter Examples Index)
The renew example can be found there (github link: Renew Slice)
All of these examples are pre-installed in your JupyterHub container and should run after you configure the environment with your username and keys.
It worked thanks!