adlConfig.ts 2.3 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {KubernetesTrialConfig} from "../kubernetesConfig";

/**
 * Checkpoint Config
 */
export class CheckpointConfig {
    public readonly storageClass: string;

    public readonly storageSize: string;

    constructor(storageClass: string, storageSize: string) {
        this.storageClass = storageClass;
        this.storageSize = storageSize;
    }
}

/**
 * imagePullSecret Config
 */
export class ImagePullSecretConfig{
    public readonly name: string;

    constructor(name: string) {
        this.name = name
    }
}

/**
 * NFS Config
 */
export class NFSConfig {
    public readonly server: string;

    public readonly path: string;

    public readonly containerMountPath: string;

    constructor(server: string, path: string, containerMountPath: string) {
        this.server = server;
        this.path = path;
        this.containerMountPath = containerMountPath;
    }
}

/**
 * Trial job configuration for Adl
 */
export class AdlTrialConfig extends KubernetesTrialConfig {

    public readonly command: string;

    public readonly gpuNum: number;

    public readonly image: string;

59
60
    public readonly namespace?: string;

61
62
63
64
65
66
67
68
69
70
71
72
73
74
    public readonly imagePullSecrets?: ImagePullSecretConfig[];

    public readonly nfs?: NFSConfig;

    public readonly checkpoint?: CheckpointConfig;

    public readonly cpuNum?: number;

    public readonly memorySize?: string;

    public readonly adaptive?: boolean; // adaptive == preemptible

    constructor(codeDir: string,
                command: string, gpuNum: number,
75
76
                image: string, namespace?: string,
                imagePullSecrets?: ImagePullSecretConfig[],
77
78
79
80
81
82
83
84
                nfs?: NFSConfig, checkpoint?: CheckpointConfig,
                cpuNum?: number, memorySize?: string,
                adaptive?: boolean
    ) {
        super(codeDir);
        this.command = command;
        this.gpuNum = gpuNum;
        this.image = image;
85
        this.namespace = namespace;
86
87
88
89
90
91
92
93
94
95
        this.imagePullSecrets = imagePullSecrets;
        this.nfs = nfs;
        this.checkpoint = checkpoint;
        this.cpuNum = cpuNum;
        this.memorySize = memorySize;
        this.adaptive = adaptive;
    }
}

export type AdlJobStatus = "Pending" | "Running" | "Starting" | "Stopping" | "Failed" | "Succeeded";