-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
sean
committed
Oct 14, 2024
1 parent
3506e26
commit 82f821a
Showing
3 changed files
with
55 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import sys | ||
import os | ||
from time import sleep | ||
|
||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'helpers'))) | ||
|
||
import cudo_api | ||
|
||
from cudo_compute import Disk, CreateVMBody | ||
from cudo_compute.rest import ApiException | ||
|
||
|
||
vm_name = 'launch-lot' | ||
id = 1 | ||
ids = [] | ||
api = cudo_api.virtual_machines() | ||
try: | ||
for i in range(12): | ||
vm_id = vm_name + str(id) | ||
disk = Disk(storage_class="STORAGE_CLASS_NETWORK", size_gib=100, | ||
id="my-disk-id-" + vm_id) | ||
|
||
request = CreateVMBody(vm_id=vm_id, machine_type="intel-broadwell", | ||
data_center_id="gb-bournemouth-1", boot_disk_image_id='ubuntu-nvidia-docker', | ||
memory_gib=4, vcpus=2, gpus=0, gpu_model="", boot_disk=disk) | ||
|
||
vm = api.create_vm(cudo_api.project_id_throwable(), request) | ||
print(vm) | ||
ids.append(vm_id) | ||
id += 1 | ||
|
||
except ApiException as e: | ||
print(e) | ||
|
||
sleep(80) | ||
for del_id in ids: | ||
res = api.terminate_vm(cudo_api.project_id_throwable(), del_id) | ||
print(res) | ||
|
||
print("done") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | |
|
||
[project] | ||
name = "cudo-compute" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
authors = [ | ||
{ name = "Cudo Ventures", email = "[email protected]" }, | ||
] | ||
|