|
1 |
| -import { ComputecenterComponent } from '../../projectmanagement/computecenter.component'; |
2 |
| -import { GPUSpecification } from './gpu-specification'; |
| 1 | +import { ComputecenterComponent } from '../../projectmanagement/computecenter.component' |
| 2 | +import { GPUSpecification } from './gpu-specification' |
3 | 3 |
|
4 | 4 | /**
|
5 | 5 | * ResourceMachine class.
|
6 | 6 | */
|
7 | 7 |
|
8 | 8 | export class ResourceMachine {
|
9 |
| - id: string; |
10 |
| - compute_center: ComputecenterComponent; |
11 |
| - name: string; |
12 |
| - ram_public_factor: number = 1; |
13 |
| - ram_private_factor: number = 1; |
14 |
| - cores: number = 0; |
15 |
| - cores_private_factor: number = 1; |
16 |
| - cores_public_factor: number = 1; |
17 |
| - gpu_slots: number = 0; |
18 |
| - gpu_used: GPUSpecification[] = []; |
19 |
| - public_count: number = 0; |
20 |
| - private_count: number = 0; |
21 |
| - ram: number = 0; |
22 |
| - type: string = 'GENERAL_PURPOSE'; |
23 |
| - local_disk_storage: number = 0; |
24 |
| - local_disk_encrypted: boolean = false; |
| 9 | + id: string |
| 10 | + compute_center: ComputecenterComponent |
| 11 | + name: string |
| 12 | + ram_public_factor: number = 1 |
| 13 | + ram_private_factor: number = 1 |
| 14 | + cores: number = 0 |
| 15 | + cores_private_factor: number = 1 |
| 16 | + cores_public_factor: number = 1 |
| 17 | + gpu_slots: number = 0 |
| 18 | + gpu_used: GPUSpecification[] = [] |
| 19 | + public_count: number = 0 |
| 20 | + private_count: number = 0 |
| 21 | + ram: number = 0 |
| 22 | + type: string = 'GENERAL_PURPOSE' |
| 23 | + local_disk_storage: number = 0 |
| 24 | + local_disk_encrypted: boolean = false |
25 | 25 |
|
26 | 26 | constructor(resourceMachine: ResourceMachine | null) {
|
27 | 27 | if (resourceMachine) {
|
28 |
| - this.id = resourceMachine.id; |
29 |
| - this.compute_center = resourceMachine.compute_center; |
30 |
| - this.name = resourceMachine.name; |
31 |
| - // eslint-disable-next-line no-multi-assign,no-param-reassign |
32 |
| - this.ram_public_factor = resourceMachine.ram_public_factor = 1; |
33 |
| - // eslint-disable-next-line no-multi-assign,no-param-reassign |
34 |
| - this.ram_private_factor = resourceMachine.ram_private_factor = 1; |
35 |
| - this.cores = resourceMachine.cores; |
36 |
| - this.local_disk_storage = resourceMachine.local_disk_storage; |
37 |
| - this.local_disk_encrypted = resourceMachine.local_disk_encrypted; |
38 |
| - this.cores_private_factor = resourceMachine.cores_private_factor; |
39 |
| - this.cores_public_factor = resourceMachine.cores_public_factor; |
40 |
| - this.gpu_slots = resourceMachine.gpu_slots; |
41 |
| - this.gpu_used = resourceMachine.gpu_used; |
42 |
| - this.public_count = resourceMachine.public_count; |
43 |
| - this.private_count = resourceMachine.private_count; |
44 |
| - this.ram = resourceMachine.ram; |
45 |
| - this.type = resourceMachine.type; |
| 28 | + this.id = resourceMachine.id |
| 29 | + this.compute_center = resourceMachine.compute_center |
| 30 | + this.name = resourceMachine.name |
| 31 | + |
| 32 | + this.ram_public_factor = resourceMachine.ram_public_factor = 1 |
| 33 | + |
| 34 | + this.ram_private_factor = resourceMachine.ram_private_factor = 1 |
| 35 | + this.cores = resourceMachine.cores |
| 36 | + this.local_disk_storage = resourceMachine.local_disk_storage |
| 37 | + this.local_disk_encrypted = resourceMachine.local_disk_encrypted |
| 38 | + this.cores_private_factor = resourceMachine.cores_private_factor |
| 39 | + this.cores_public_factor = resourceMachine.cores_public_factor |
| 40 | + this.gpu_slots = resourceMachine.gpu_slots |
| 41 | + this.gpu_used = resourceMachine.gpu_used |
| 42 | + this.public_count = resourceMachine.public_count |
| 43 | + this.private_count = resourceMachine.private_count |
| 44 | + this.ram = resourceMachine.ram |
| 45 | + this.type = resourceMachine.type |
46 | 46 | if (this.gpu_used.length < this.gpu_slots) {
|
47 | 47 | while (this.gpu_used.length < this.gpu_slots) {
|
48 |
| - this.gpu_used.push(new GPUSpecification(null)); |
| 48 | + this.gpu_used.push(new GPUSpecification(null)) |
49 | 49 | }
|
50 | 50 | }
|
51 | 51 | }
|
52 | 52 | }
|
53 | 53 |
|
54 | 54 | changeGpuUsed(): void {
|
55 | 55 | if (this.gpu_slots < this.gpu_used.length) {
|
56 |
| - this.gpu_used = this.gpu_used.slice(0, this.gpu_slots); |
| 56 | + this.gpu_used = this.gpu_used.slice(0, this.gpu_slots) |
57 | 57 | } else {
|
58 | 58 | while (this.gpu_slots > this.gpu_used.length) {
|
59 |
| - this.gpu_used.push(new GPUSpecification(null)); |
| 59 | + this.gpu_used.push(new GPUSpecification(null)) |
60 | 60 | }
|
61 | 61 | }
|
62 | 62 | }
|
|
0 commit comments