paiData.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
10
/**
 * PAI trial job detail
 */
11
12
13
14
15
16
17
18
19
20
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;
21
    public form: TrialJobApplicationForm;
22
    public hdfsLogPath: string;
23
    public isEarlyStopped?: boolean;
24

chicm-ms's avatar
chicm-ms committed
25
    constructor(id: string, status: TrialJobStatus, paiJobName: string,
26
                submitTime: number, workingDirectory: string, form: TrialJobApplicationForm, hdfsLogPath: string) {
27
28
29
30
31
32
33
34
35
36
37
        this.id = id;
        this.status = status;
        this.paiJobName = paiJobName;
        this.submitTime = submitTime;
        this.workingDirectory = workingDirectory;
        this.form = form;
        this.tags = [];
        this.hdfsLogPath = hdfsLogPath;
    }
}

38
export const PAI_INSTALL_NNI_SHELL_FORMAT: string =
fishyds's avatar
fishyds committed
39
40
41
42
43
44
`#!/bin/bash
if python3 -c 'import nni' > /dev/null 2>&1; then
  # nni module is already installed, skip
  return
else
  # Install nni
Gems Guo's avatar
Gems Guo committed
45
  python3 -m pip install --user nni
fishyds's avatar
fishyds committed
46
47
fi`;

48
export const PAI_TRIAL_COMMAND_FORMAT: string =
49
`export NNI_PLATFORM=pai NNI_SYS_DIR={0} NNI_OUTPUT_DIR={1} NNI_TRIAL_JOB_ID={2} NNI_EXP_ID={3} NNI_TRIAL_SEQ_ID={4} MULTI_PHASE={5} \
50
&& cd $NNI_SYS_DIR && sh install_nni.sh \
51
52
53
&& python3 -m nni_trial_tool.trial_keeper --trial_command '{6}' --nnimanager_ip '{7}' --nnimanager_port '{8}' \
--pai_hdfs_output_dir '{9}' --pai_hdfs_host '{10}' --pai_user_name {11} --nni_hdfs_exp_dir '{12}' --webhdfs_path '/webhdfs/api/v1' \
--nni_manager_version '{13}' --log_collection '{14}'`;
54

55
export const PAI_LOG_PATH_FORMAT: string =
56
`http://{0}/webhdfs/explorer.html#{1}`;