paiConfig.ts 1.93 KB
Newer Older
liuzhe-lz's avatar
liuzhe-lz committed
1
2
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
3
4
5

'use strict';

6
import { TrialJobApplicationForm, TrialJobDetail, TrialJobStatus  } from '../../common/trainingService';
7
8
9

export class PAIClusterConfig {
    public readonly userName: string;
10
    public readonly passWord?: string;
SparkSnail's avatar
SparkSnail committed
11
    public host: string;
12
    public readonly token?: string;
13
    public readonly reuse?: boolean;
14
15
16
17
18
19

    /**
     * Constructor
     * @param userName User name of PAI Cluster
     * @param passWord password of PAI Cluster
     * @param host Host IP of PAI Cluster
20
     * @param token PAI token of PAI Cluster
21
     * @param reuse If job is reusable for multiple trials
22
     */
23
    constructor(userName: string, host: string, passWord?: string, token?: string, reuse?: boolean) {
24
25
26
        this.userName = userName;
        this.passWord = passWord;
        this.host = host;
27
        this.token = token;
28
        this.reuse = reuse;
29
30
31
    }
}

32
/**
33
 * PAI trial job detail
34
 */
35
36
37
38
39
40
41
42
43
44
45
46
47
export class PAITrialJobDetail implements TrialJobDetail {
    public id: string;
    public status: TrialJobStatus;
    public paiJobName: string;
    public submitTime: number;
    public startTime?: number;
    public endTime?: number;
    public tags?: string[];
    public url?: string;
    public workingDirectory: string;
    public form: TrialJobApplicationForm;
    public logPath: string;
    public isEarlyStopped?: boolean;
SparkSnail's avatar
SparkSnail committed
48
    public paiJobDetailUrl?: string;
49
50

    constructor(id: string, status: TrialJobStatus, paiJobName: string,
SparkSnail's avatar
SparkSnail committed
51
                submitTime: number, workingDirectory: string, form: TrialJobApplicationForm, logPath: string, paiJobDetailUrl?: string) {
52
53
54
55
56
57
58
59
        this.id = id;
        this.status = status;
        this.paiJobName = paiJobName;
        this.submitTime = submitTime;
        this.workingDirectory = workingDirectory;
        this.form = form;
        this.tags = [];
        this.logPath = logPath;
SparkSnail's avatar
SparkSnail committed
60
        this.paiJobDetailUrl = paiJobDetailUrl;
61
    }
62
}