polaris-cli-tool
Version:
Polaris CLI - Modern Development Workspace Manager for Distributed Compute Resources
133 lines (127 loc) • 3.27 kB
JavaScript
// create_template.js
import xlsx from 'xlsx';
const headers = [
'id',
'resource_type',
'location',
'internal_ip',
'ssh',
'open_ports',
'hourly_price',
'ram',
'storage_type',
'storage_capacity',
'storage_read_speed',
'storage_write_speed',
// CPU Specs
'cpu_op_modes',
'cpu_address_sizes',
'cpu_byte_order',
'total_cpus',
'online_cpus',
'vendor_id',
'cpu_name',
'cpu_family',
'model',
'threads_per_core',
'cores_per_socket',
'sockets',
'stepping',
'cpu_max_mhz',
'cpu_min_mhz',
// GPU Specs
'gpu_name',
'memory_size',
'cuda_cores',
'clock_speed',
'power_consumption'
];
const data = [
{
// High-end CPU compute resource
id: 'compute1',
resource_type: 'CPU',
location: 'NYC-RACK-01',
internal_ip: '192.168.1.10',
ssh: 'ssh://user@192.168.1.10:22',
open_ports: '22,80,443,3000',
hourly_price: 2.0,
ram: '128GB',
storage_type: 'NVME',
storage_capacity: '4TB',
storage_read_speed: '7000MB/s',
storage_write_speed: '5000MB/s',
cpu_op_modes: '32-bit, 64-bit',
cpu_address_sizes: '46 bits physical, 48 bits virtual',
cpu_byte_order: 'Little Endian',
total_cpus: 32,
online_cpus: '0-31',
vendor_id: 'GenuineIntel',
cpu_name: 'Intel(R) Xeon(R) Platinum 8380 CPU @ 2.30GHz',
cpu_family: 6,
model: 85,
threads_per_core: 2,
cores_per_socket: 8,
sockets: 2,
stepping: 4,
cpu_max_mhz: 3400.0,
cpu_min_mhz: 1000.0
},
{
// High-performance GPU compute resource
id: 'compute2',
resource_type: 'GPU',
location: 'NYC-RACK-02',
internal_ip: '192.168.1.11',
ssh: 'ssh://user@192.168.1.11:22',
open_ports: '22,80,443,8080',
hourly_price: 3.5,
ram: '256GB',
storage_type: 'NVME',
storage_capacity: '8TB',
storage_read_speed: '7000MB/s',
storage_write_speed: '5000MB/s',
gpu_name: 'NVIDIA A100',
memory_size: '80GB',
cuda_cores: 6912,
clock_speed: '1410MHz',
power_consumption: '400W'
},
{
// Mid-range CPU compute resource
id: 'compute3',
resource_type: 'CPU',
location: 'NYC-RACK-03',
internal_ip: '192.168.1.12',
ssh: 'ssh://user@192.168.1.12:22',
open_ports: '22,80,443',
hourly_price: 1.5,
ram: '64GB',
storage_type: 'SSD',
storage_capacity: '2TB',
storage_read_speed: '3500MB/s',
storage_write_speed: '3000MB/s',
cpu_op_modes: '32-bit, 64-bit',
cpu_address_sizes: '46 bits physical, 48 bits virtual',
cpu_byte_order: 'Little Endian',
total_cpus: 16,
online_cpus: '0-15',
vendor_id: 'GenuineIntel',
cpu_name: 'Intel(R) Xeon(R) E-2288G CPU @ 3.70GHz',
cpu_family: 6,
model: 85,
threads_per_core: 2,
cores_per_socket: 4,
sockets: 2,
stepping: 4,
cpu_max_mhz: 5000.0,
cpu_min_mhz: 800.0
}
];
const workbook = xlsx.utils.book_new();
const worksheet = xlsx.utils.json_to_sheet(data, { headers: headers });
// Add some styling to the header row
worksheet['!cols'] = headers.map(() => ({ wch: 20 })); // Set column width
xlsx.utils.book_append_sheet(workbook, worksheet, 'Compute Resources');
xlsx.writeFile(workbook, 'compute_resources_template.xlsx');
console.log('Excel template has been created successfully!');