Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions create_machine_json/create_cpus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"last_update": null,
"machine_id": 5,
"product_name": "Intel® Core™ i5-6500 CPU @ 3.20GHz",
"ncores": 4,
"threads_per_core": 1,
"has_avx": 1,
"flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d",
"totalram": 15989,
"freeram": 2784,
"availram": 8724,
"bw_cpu_ram": null,
"ghz": 3.6,
"deleted_at": null
}
14 changes: 14 additions & 0 deletions create_machine_json/create_disks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": 2,
"last_update": 1646341480.881224,
"machine_id": 5,
"idx": 0,
"product_name": "Seagate ST4000DM000",
"totalram": 512,
"allocram": 0,
"freeram": 461,
"bw_dev_cpu": 154.95293644673077,
"bw_cpu_dev": null,
"deleted_at": null,
"availram": null
}
29 changes: 29 additions & 0 deletions create_machine_json/create_gpus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id": 6,
"deleted_at": null,
"last_update": 1668805172.889153,
"machine_id": 5,
"idx": 0,
"product_name": "GTX 1070",
"compute_cap": 610,
"mguid": null,
"ncores": 1920,
"totalram": 8111,
"freeram": 7554,
"bw_dev_ram": 185.1,
"bw_dev_cpu": 11.4,
"bw_cpu_dev": 11.9,
"gpu_curclock": 1.6096,
"mem_curclock": null,
"gpu_maxclock": 2.012,
"mem_maxclock": null,
"tflops": 7.72608,
"cur_temp": 38,
"max_temp": 99,
"cur_power": 16.89,
"max_power": 220,
"pci_gen": 3,
"pci_width": 16,
"display_active": false,
"bw_nvlink": null
}
8 changes: 8 additions & 0 deletions create_machine_json/create_inetworks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"last_update": 1680567761.535719,
"bwu_max": 10,
"bwd_max": 12,
"bwu_cur": 12,
"bwd_cur": 12,
"deleted_at": null
}
8 changes: 8 additions & 0 deletions create_machine_json/create_lnetworks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"last_update": 1680567761.535719,
"bwu_max": 10,
"bwd_max": 12,
"bwu_cur": 12,
"bwd_cur": 12,
"deleted_at": null
}
59 changes: 59 additions & 0 deletions create_machine_json/create_machine.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"last_update": 1645135069.421457,
"deleted_at": 1646341480.7514,
"api_key": "2bcb60f2d30e5dc8779b1420b08ff71f20b80aaddac278ae04918c14c93c09b2",
"owner_id": 2,
"connected_to": null,
"connection_id": null,
"driver_version": "470.57.02",
"driver_vers": null,
"kernel_version": null,
"docker_version": null,
"containerd_version": null,
"runc_version": null,
"cuda_max_good": 11.4,
"cuda_min_bad": null,
"lnet_id": 2,
"inet_id": null,
"hbroker_id": null,
"last_seen": null,
"last_active": 1645135067.2225902,
"last_messaged": null,
"last_kaalia_metadata": "{\"args\": {\"auth\": \"b36f287f5da5bef262b9bc9ff9d2078c7685ddf591d29d7a05ef28ff47a58d53\", \"backend\": \"DKR\", \"docker_drive\": \"/dev/sda5\", \"fast_init\": \"1\", \"image.no_delete\": \"true\", \"installpath\": \"/home/jcannell/cuda-workspace/vast/\", \"machineid_fn\": \"machine_id\", \"nvlink_test\": \"1\", \"server.ip\": \"127.0.0.1\", \"server.port\": \"7070\", \"skip_dmi\": \"1\", \"skip_nv\": \"1\", \"skip_xfs\": \"1\"}, \"startup_time\": 1645135050.4131722, \"version\": \"daemon-210:e34665bb632d2c28131b26a42374e0113b6d3d28:Thu Feb 17 08:16:13 PST 2022\"}",
"last_kaalia_version": "daemon-210:e34665bb632d2c28131b26a42374e0113b6d3d28:Thu Feb 17 08:16:13 PST 2022",
"mobo_prodname": "Z170M Extreme4",
"uname": "Linux velocity 4.15.0-167-generic #175-Ubuntu SMP Wed Jan 5 01:56:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux",
"hostname": "velocity",
"local_ips": null,
"ssh_forwarder_id": null,
"ssh_forwarder_port": null,
"earn_min": 0,
"earn_hour": 0,
"earn_day": 0,
"loss_min": 0,
"loss_hour": 0,
"loss_day": 0,
"verification": "verified",
"error_description": "bad bandwidthtest: sh: 1: /home/jcannell/cuda-workspace/vast/bandwidthTest: not found\n",
"error_msg": null,
"sys_uptime": 784343,
"sys_uptime_last": 784343,
"sys_uptime_proc": null,
"uptime": null,
"downtime": null,
"reliability": 0.999975,
"reliability2": 0.9897929,
"reliability_mult": 0.9073324,
"min_bid_price": null,
"public_ipaddr": "127.0.0.1",
"public_ipaddr2": null,
"geolocation": null,
"direct_port_start": null,
"direct_port_count": null,
"hosting_type": null,
"ubuntu_version": null,
"dlperf_mult": null,
"num_reports": null,
"num_recent_reports": null,
"last_reported": null
}
38 changes: 38 additions & 0 deletions vast.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import getpass
import subprocess
from subprocess import PIPE
from loguru import logger

try:
from urllib import quote_plus # Python 2.X
Expand Down Expand Up @@ -1185,6 +1186,43 @@ def create__team_role(args):
r.raise_for_status()
print(r.json())


@parser.command(
usage="create a mock machine",
help="Create a mock machine",
)
def create__mock_machine(args):
def read_json_from_file(file_path):
with open(file_path, 'r') as file:
return json.load(file)

# File paths
cpu_file = 'create_machine/create_cpus.json'
gpu_file = 'create_machine/create_gpus.json'
disk_file = 'create_machine/create_disks.json'
inetworks_file = "create_machine/create_inetworks.json"
lnetworks_file = "create_machine/create_lnetworks.json"
machine_file = "create_machine/create_machine.json"

data = {
"cpu_info": read_json_from_file(cpu_file),
"gpu_info": read_json_from_file(gpu_file),
"disks_info": read_json_from_file(disk_file),
"inetworks_info": read_json_from_file(inetworks_file),
"lnetworks_info": read_json_from_file(lnetworks_file),
"machine_info": read_json_from_file(machine_file)
}

url = f'{ server_url_default }/api/admin/create-machine/'
response = requests.post(url, json=data, headers=headers)

if response.status_code == 200:
logger.info("Machine created successfully")
logger.info(response.json())
else:
logger.error("Status Code:", response.status_code)
logger.error("Response Body:", response.text)

@parser.command(
argument("ID", help="id of apikey to remove", type=int),
usage="vastai delete api-key ID",
Expand Down