Skip to content

Commit 2181d48

Browse files
Ahmad, Sufianmboglesby
authored andcommitted
Allocation resource option for jupyter clone.
1 parent 7bf7d1f commit 2181d48

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

netapp_dataops_k8s/netapp_dataops/netapp_dataops_k8s_cli.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
\t-p, --cpu=\t\t\tNumber of CPUs to reserve for new JupyterLab workspace. Format: '0.5', '1', etc. If not specified, no CPUs will be reserved.
130130
\t-s, --source-snapshot-name=\tName of Kubernetes VolumeSnapshot to use as source for clone. Either -s/--source-snapshot-name or -j/--source-workspace-name must be specified.
131131
\t-b, --load-balancer\t\tOption to use a LoadBalancer instead of using NodePort service. If not specified, NodePort service will be utilized.
132+
\t-r, --allocate-resource\t\tOption to specify custom resource allocations, ex. 'nvidia.com/mig-1g.5gb=1'. If not specified, no custom resource will be allocated.
132133
133134
Examples:
134135
\tnetapp_dataops_k8s_cli.py clone jupyterlab --new-workspace-name=project1-experiment1 --source-workspace-name=project1 --nvidia-gpu=1
@@ -212,7 +213,7 @@
212213
\t-b, --load-balancer\t\tOption to use a LoadBalancer instead of using NodePort service. If not specified, NodePort service will be utilized.
213214
\t-a, --register-with-astra\tRegister new workspace with Astra Control (requires Astra Control).
214215
\t-v, --mount-pvc\t\t\tOption to attach an additional existing PVC that can be mounted at a spefic path whithin the container. Format: -v/--mount-pvc=existing_pvc_name:mount_point. If not specified, no additional PVC will be attached.
215-
\t-r, --allocate-resource=\t\t\Option to specify custom resource allocations, ex. 'nvidia.com/mig-1g.5gb=1'. If not specified, no custom resource will be allocated.
216+
\t-r, --allocate-resource=\t\t\Option to specify custom resource allocations, ex. 'nvidia.com/mig-1g.5gb=1'. If not specified, no custom resource will be allocated.
216217
217218
Examples:
218219
\tnetapp_dataops_k8s_cli.py create jupyterlab --workspace-name=mike --size=10Gi --nvidia-gpu=2
@@ -236,7 +237,7 @@
236237
\t-n, --namespace=\t\tKubernetes namespace to create new instance in. If not specified, instance will be created in namespace "default".
237238
\t-p, --cpu=\t\t\tNumber of CPUs to reserve for Triton instance. Format: '0.5', '1', etc. If not specified, no CPUs will be reserved.
238239
\t-b, --load-balancer\t\tOption to use a LoadBalancer instead of using NodePort service. If not specified, NodePort service will be utilized.
239-
\t-r, --allocate-resource\t\tOption to specify custom resource allocations, ex. 'nvidia.com/mig-1g.5gb=1'. If not specified, no custom resource will be allocated.
240+
\t-r, --allocate-resource\t\tOption to specify custom resource allocations, ex. 'nvidia.com/mig-1g.5gb=1'. If not specified, no custom resource will be allocated.
240241
241242
Examples:
242243
\tnetapp_dataops_k8s_cli.py create triton-server --server-name=Test --model-repo-pvc-name=model-pvc
@@ -856,13 +857,14 @@ def getTarget(args: list) -> str:
856857
requestMemory = None
857858
requestCpu = None
858859
load_balancer_service= False
860+
allocate_resource = None
859861

860862
# Get command line options
861863
try:
862-
opts, args = getopt.getopt(sys.argv[3:], "hw:c:n:s:j:g:m:p:b",
864+
opts, args = getopt.getopt(sys.argv[3:], "hw:c:n:s:j:g:m:p:br:",
863865
["help", "new-workspace-name=", "volume-snapshot-class=", "namespace=",
864866
"source-snapshot-name=", "source-workspace-name=", "nvidia-gpu=", "memory=",
865-
"cpu=", "load-balancer"])
867+
"cpu=", "load-balancer", "allocate-resource="])
866868
except:
867869
handleInvalidCommand(helpText=helpTextCloneJupyterLab, invalidOptArg=True)
868870

@@ -889,6 +891,8 @@ def getTarget(args: list) -> str:
889891
requestCpu = arg
890892
elif opt in ("-b", "--load-balancer"):
891893
load_balancer_service = True
894+
elif opt in ("-r", "--allocate-resource"):
895+
allocate_resource = arg
892896

893897
# Check for required options
894898
if not newWorkspaceName or (not sourceSnapshotName and not sourceWorkspaceName):
@@ -903,7 +907,7 @@ def getTarget(args: list) -> str:
903907
clone_jupyter_lab(new_workspace_name=newWorkspaceName, source_workspace_name=sourceWorkspaceName, load_balancer_service=load_balancer_service,
904908
source_snapshot_name=sourceSnapshotName, volume_snapshot_class=volumeSnapshotClass,
905909
namespace=namespace, request_cpu=requestCpu, request_memory=requestMemory,
906-
request_nvidia_gpu=requestNvidiaGpu, print_output=True)
910+
request_nvidia_gpu=requestNvidiaGpu, allocate_resource=allocate_resource, print_output=True)
907911
except (InvalidConfigError, APIConnectionError):
908912
sys.exit(1)
909913

0 commit comments

Comments
 (0)