Skaha¶
A lightweight python interface to the CANFAR Science Platform.
New in v1.4+
Support for Private Container Images on Harbor
Starting October 2024, to create a session with a private container image from the CANFAR Harbor Registry, you will need to provide your harbor username
and the CLI Secret
through a ContainerRegistry
object.
from skaha.models import ContainerRegistry
from skaha.session import Session
registry = ContainerRegistry(username="username", secret="sUp3rS3cr3t")
session = Session(registry=registry)
Alernatively, if you have environment variables, SKAHA_REGISTRY_USERNAME
and SKAHA_REGISTRY_SECRET
, you can create a ContainerRegistry
object without providing the username
and secret
.
from skaha.models import ContainerRegistry
registry = ContainerRegistry()
Destroy Sessions without ids
from skaha.session import Session
session = Session()
session.destroy_with(prefix="test", kind="headless", status="Running")
session.destroy_with(prefix="test", kind="headless", status="Pending")
Example
from skaha.session import Session
session = Session()
session_id = session.create(
name="test",
image="images.canfar.net/skaha/base-notebook:latest",
cores=2,
ram=8,
gpu=1,
kind="headless",
cmd="env",
env={"KEY": "VALUE"},
replicas=3,
)