Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
5fc73ba6
Unverified
Commit
5fc73ba6
authored
Aug 27, 2021
by
liuzhe-lz
Committed by
GitHub
Aug 27, 2021
Browse files
Refactor NNI Manager UT (Stage 1) - setup toolchain (#4109)
parent
2b9f5f8c
Changes
121
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
136 additions
and
157 deletions
+136
-157
ts/nni_manager/training_service/reusable/environment.ts
ts/nni_manager/training_service/reusable/environment.ts
+3
-5
ts/nni_manager/training_service/reusable/environments/amlEnvironmentService.ts
...ng_service/reusable/environments/amlEnvironmentService.ts
+7
-9
ts/nni_manager/training_service/reusable/environments/dlcEnvironmentService.ts
...ng_service/reusable/environments/dlcEnvironmentService.ts
+6
-8
ts/nni_manager/training_service/reusable/environments/environmentServiceFactory.ts
...ervice/reusable/environments/environmentServiceFactory.ts
+5
-5
ts/nni_manager/training_service/reusable/environments/kubernetes/kubeflowEnvironmentService.ts
...ble/environments/kubernetes/kubeflowEnvironmentService.ts
+9
-11
ts/nni_manager/training_service/reusable/environments/kubernetes/kubernetesEnvironmentService.ts
...e/environments/kubernetes/kubernetesEnvironmentService.ts
+13
-15
ts/nni_manager/training_service/reusable/environments/localEnvironmentService.ts
..._service/reusable/environments/localEnvironmentService.ts
+11
-13
ts/nni_manager/training_service/reusable/environments/openPaiEnvironmentService.ts
...ervice/reusable/environments/openPaiEnvironmentService.ts
+8
-10
ts/nni_manager/training_service/reusable/environments/remoteEnvironmentService.ts
...service/reusable/environments/remoteEnvironmentService.ts
+9
-11
ts/nni_manager/training_service/reusable/gpuScheduler.ts
ts/nni_manager/training_service/reusable/gpuScheduler.ts
+4
-5
ts/nni_manager/training_service/reusable/remote/remoteConfig.ts
..._manager/training_service/reusable/remote/remoteConfig.ts
+1
-1
ts/nni_manager/training_service/reusable/routerTrainingService.ts
...anager/training_service/reusable/routerTrainingService.ts
+6
-8
ts/nni_manager/training_service/reusable/sharedStorage.ts
ts/nni_manager/training_service/reusable/sharedStorage.ts
+1
-3
ts/nni_manager/training_service/reusable/shared_storages/azureblobStorageService.ts
...rvice/reusable/shared_storages/azureblobStorageService.ts
+5
-7
ts/nni_manager/training_service/reusable/shared_storages/nfsStorageService.ts
...ing_service/reusable/shared_storages/nfsStorageService.ts
+5
-7
ts/nni_manager/training_service/reusable/storageService.ts
ts/nni_manager/training_service/reusable/storageService.ts
+5
-7
ts/nni_manager/training_service/reusable/storages/mountedStorageService.ts
...aining_service/reusable/storages/mountedStorageService.ts
+2
-2
ts/nni_manager/training_service/reusable/trial.ts
ts/nni_manager/training_service/reusable/trial.ts
+2
-4
ts/nni_manager/training_service/reusable/trialDispatcher.ts
ts/nni_manager/training_service/reusable/trialDispatcher.ts
+11
-13
ts/nni_manager/tsconfig.json
ts/nni_manager/tsconfig.json
+23
-13
No files found.
ts/nni_manager/training_service/reusable/environment.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
{
getLogger
,
Logger
}
from
"
../../common/log
"
;
import
{
TrialJobStatus
}
from
"
../../common/trainingService
"
;
import
{
GPUInfo
}
from
"
../../training_service/common/gpuData
"
;
import
{
getLogger
,
Logger
}
from
"
common/log
"
;
import
{
TrialJobStatus
}
from
"
common/trainingService
"
;
import
{
GPUInfo
}
from
"
training_service/common/gpuData
"
;
import
{
CommandChannel
}
from
"
./commandChannel
"
;
import
{
WebCommandChannel
}
from
'
./channels/webCommandChannel
'
;
import
{
EventEmitter
}
from
"
events
"
;
...
...
ts/nni_manager/training_service/reusable/environments/amlEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
component
from
'
../../../common/component
'
;
import
{
getLogger
,
Logger
}
from
'
../../../common/log
'
;
import
{
ExperimentConfig
,
AmlConfig
,
flattenConfig
}
from
'
../../../common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../common/experimentStartupInfo
'
;
import
{
validateCodeDir
}
from
'
../../common/util
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
*
as
component
from
'
common/component
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
ExperimentConfig
,
AmlConfig
,
flattenConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
validateCodeDir
}
from
'
training_service/common/util
'
;
import
{
AMLClient
}
from
'
../aml/amlClient
'
;
import
{
AMLEnvironmentInformation
}
from
'
../aml/amlConfig
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../environment
'
;
...
...
ts/nni_manager/training_service/reusable/environments/dlcEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
component
from
'
../../../common/component
'
;
import
{
getLogger
,
Logger
}
from
'
../../../common/log
'
;
import
{
ExperimentConfig
,
DlcConfig
,
flattenConfig
}
from
'
../../../common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../common/experimentStartupInfo
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
*
as
component
from
'
common/component
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
ExperimentConfig
,
DlcConfig
,
flattenConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
DlcClient
}
from
'
../dlc/dlcClient
'
;
import
{
DlcEnvironmentInformation
}
from
'
../dlc/dlcConfig
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../environment
'
;
...
...
ts/nni_manager/training_service/reusable/environments/environmentServiceFactory.ts
View file @
5fc73ba6
...
...
@@ -4,10 +4,10 @@ import { LocalEnvironmentService } from './localEnvironmentService';
import
{
RemoteEnvironmentService
}
from
'
./remoteEnvironmentService
'
;
import
{
KubeflowEnvironmentService
}
from
'
./kubernetes/kubeflowEnvironmentService
'
;
import
{
EnvironmentService
}
from
'
../environment
'
;
import
{
ExperimentConfig
}
from
'
../../../
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../
common/experimentStartupInfo
'
;
import
{
getCustomEnvironmentServiceConfig
}
from
'
../../../
common/nniConfig
'
;
import
{
importModule
}
from
'
../../../
common/utils
'
;
import
{
ExperimentConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
getCustomEnvironmentServiceConfig
}
from
'
common/nniConfig
'
;
import
{
importModule
}
from
'
common/utils
'
;
import
{
DlcEnvironmentService
}
from
'
./dlcEnvironmentService
'
;
export
async
function
createEnvironmentService
(
name
:
string
,
config
:
ExperimentConfig
):
Promise
<
EnvironmentService
>
{
...
...
ts/nni_manager/training_service/reusable/environments/kubernetes/kubeflowEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
component
from
'
../../../../common/component
'
;
import
{
ExperimentConfig
,
KubeflowConfig
,
flattenConfig
}
from
'
../../../../common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../../common/experimentStartupInfo
'
;
import
{
EnvironmentInformation
}
from
'
../../environment
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
*
as
component
from
'
common/component
'
;
import
{
ExperimentConfig
,
KubeflowConfig
,
flattenConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
EnvironmentInformation
}
from
'
training_service/reusable/environment
'
;
import
{
KubernetesEnvironmentService
}
from
'
./kubernetesEnvironmentService
'
;
import
{
KubeflowOperatorClientFactory
}
from
'
../../..
/kubernetes/kubeflow/kubeflowApiClient
'
;
import
{
KubeflowClusterConfigAzure
}
from
'
../../..
/kubernetes/kubeflow/kubeflowConfig
'
;
import
{
KeyVaultConfig
,
AzureStorage
}
from
'
../../..
/kubernetes/kubernetesConfig
'
;
import
{
KubeflowOperatorClientFactory
}
from
'
training_service
/kubernetes/kubeflow/kubeflowApiClient
'
;
import
{
KubeflowClusterConfigAzure
}
from
'
training_service
/kubernetes/kubeflow/kubeflowConfig
'
;
import
{
KeyVaultConfig
,
AzureStorage
}
from
'
training_service
/kubernetes/kubernetesConfig
'
;
interface
FlattenKubeflowConfig
extends
ExperimentConfig
,
KubeflowConfig
{
}
...
...
ts/nni_manager/training_service/reusable/environments/kubernetes/kubernetesEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
cpp
from
'
child-process-promise
'
;
import
*
as
path
from
'
path
'
;
import
*
as
azureStorage
from
'
azure-storage
'
;
import
cpp
from
'
child-process-promise
'
;
import
path
from
'
path
'
;
import
azureStorage
from
'
azure-storage
'
;
import
{
Base64
}
from
'
js-base64
'
;
import
{
String
}
from
'
typescript-string-operations
'
;
import
{
ExperimentConfig
}
from
'
../../../../
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../../
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
../../../../
common/log
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../..
/environment
'
;
import
{
GeneralK8sClient
,
KubernetesCRDClient
}
from
'
../../..
/kubernetes/kubernetesApiClient
'
;
import
{
AzureStorageClientUtility
}
from
'
../../..
/kubernetes/azureStorageClientUtils
'
;
import
{
KubeflowJobStatus
}
from
'
../../..
/kubernetes/kubeflow/kubeflowConfig
'
;
import
{
delay
,
uniqueString
}
from
'
../../../../
common/utils
'
;
import
{
ExperimentConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
training_service/reusable
/environment
'
;
import
{
GeneralK8sClient
,
KubernetesCRDClient
}
from
'
training_service
/kubernetes/kubernetesApiClient
'
;
import
{
AzureStorageClientUtility
}
from
'
training_service
/kubernetes/azureStorageClientUtils
'
;
import
{
KubeflowJobStatus
}
from
'
training_service
/kubernetes/kubeflow/kubeflowConfig
'
;
import
{
delay
,
uniqueString
}
from
'
common/utils
'
;
const
fs
=
require
(
'
fs
'
);
export
class
KubernetesEnvironmentService
extends
EnvironmentService
{
...
...
@@ -35,7 +33,7 @@ export class KubernetesEnvironmentService extends EnvironmentService {
protected
log
:
Logger
=
getLogger
(
'
KubernetesEnvironmentService
'
);
protected
environmentWorkingFolder
:
string
;
constructor
(
config
:
ExperimentConfig
,
info
:
ExperimentStartupInfo
)
{
constructor
(
_
config
:
ExperimentConfig
,
info
:
ExperimentStartupInfo
)
{
super
();
this
.
CONTAINER_MOUNT_PATH
=
'
/tmp/mount
'
;
this
.
genericK8sClient
=
new
GeneralK8sClient
();
...
...
@@ -234,7 +232,7 @@ export class KubernetesEnvironmentService extends EnvironmentService {
});
}
public
async
startEnvironment
(
environment
:
EnvironmentInformation
):
Promise
<
void
>
{
public
async
startEnvironment
(
_
environment
:
EnvironmentInformation
):
Promise
<
void
>
{
throw
new
Error
(
"
Not implemented
"
);
}
...
...
ts/nni_manager/training_service/reusable/environments/localEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
tkill
from
'
tree-kill
'
;
import
*
as
component
from
'
../../../common/component
'
;
import
{
getLogger
,
Logger
}
from
'
../../../common/log
'
;
import
{
ExperimentConfig
}
from
'
../../../common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../common/experimentStartupInfo
'
;
import
{
powershellString
}
from
'
../../../common/shellUtils
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
tkill
from
'
tree-kill
'
;
import
*
as
component
from
'
common/component
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
ExperimentConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
powershellString
}
from
'
common/shellUtils
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../environment
'
;
import
{
isAlive
,
getNewLine
}
from
'
../../../
common/utils
'
;
import
{
execMkdir
,
runScript
,
getScriptName
,
execCopydir
}
from
'
../..
/common/util
'
;
import
{
isAlive
,
getNewLine
}
from
'
common/utils
'
;
import
{
execMkdir
,
runScript
,
getScriptName
,
execCopydir
}
from
'
training_service
/common/util
'
;
import
{
SharedStorageService
}
from
'
../sharedStorage
'
@
component
.
Singleton
...
...
@@ -81,7 +79,7 @@ export class LocalEnvironmentService extends EnvironmentService {
private
getScript
(
environment
:
EnvironmentInformation
):
string
[]
{
const
script
:
string
[]
=
[];
if
(
process
.
platform
===
'
win32
'
)
{
script
.
push
(
`$env:PATH=
${
powershellString
(
process
.
env
.
path
!
)}
`
)
script
.
push
(
`$env:PATH=
${
powershellString
(
process
.
env
[
'
path
'
]
!
)}
`
)
script
.
push
(
`cd $env:
${
this
.
experimentRootDir
}
`
);
script
.
push
(
`New-Item -ItemType "directory" -Path
${
path
.
join
(
this
.
experimentRootDir
,
'
envs
'
,
environment
.
id
)}
-Force`
);
script
.
push
(
`cd envs\
\$
{environment.id}`
);
...
...
ts/nni_manager/training_service/reusable/environments/openPaiEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
yaml
from
'
js-yaml
'
;
import
*
as
request
from
'
request
'
;
import
yaml
from
'
js-yaml
'
;
import
request
from
'
request
'
;
import
{
Container
,
Scope
}
from
'
typescript-ioc
'
;
import
{
Deferred
}
from
'
ts-deferred
'
;
import
*
as
component
from
'
../../../
common/component
'
;
import
{
ExperimentConfig
,
OpenpaiConfig
,
flattenConfig
,
toMegaBytes
}
from
'
../../../
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
../../../
common/log
'
;
import
{
PAIClusterConfig
}
from
'
../..
/pai/paiConfig
'
;
import
{
NNIPAITrialConfig
}
from
'
../..
/pai/paiConfig
'
;
import
*
as
component
from
'
common/component
'
;
import
{
ExperimentConfig
,
OpenpaiConfig
,
flattenConfig
,
toMegaBytes
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
PAIClusterConfig
}
from
'
training_service
/pai/paiConfig
'
;
import
{
NNIPAITrialConfig
}
from
'
training_service
/pai/paiConfig
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../environment
'
;
import
{
SharedStorageService
}
from
'
../sharedStorage
'
;
import
{
MountedStorageService
}
from
'
../storages/mountedStorageService
'
;
...
...
ts/nni_manager/training_service/reusable/environments/remoteEnvironmentService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
*
as
component
from
'
../../../common/component
'
;
import
{
getLogger
,
Logger
}
from
'
../../../common/log
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
*
as
component
from
'
common/component
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
EnvironmentInformation
,
EnvironmentService
}
from
'
../environment
'
;
import
{
getLogLevel
}
from
'
../../../
common/utils
'
;
import
{
ExperimentConfig
,
RemoteConfig
,
RemoteMachineConfig
,
flattenConfig
}
from
'
../../../
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
../../../
common/experimentStartupInfo
'
;
import
{
execMkdir
}
from
'
../..
/common/util
'
;
import
{
ExecutorManager
}
from
'
../..
/remote_machine/remoteMachineData
'
;
import
{
getLogLevel
}
from
'
common/utils
'
;
import
{
ExperimentConfig
,
RemoteConfig
,
RemoteMachineConfig
,
flattenConfig
}
from
'
common/experimentConfig
'
;
import
{
ExperimentStartupInfo
}
from
'
common/experimentStartupInfo
'
;
import
{
execMkdir
}
from
'
training_service
/common/util
'
;
import
{
ExecutorManager
}
from
'
training_service
/remote_machine/remoteMachineData
'
;
import
{
ShellExecutor
}
from
'
training_service/remote_machine/shellExecutor
'
;
import
{
RemoteMachineEnvironmentInformation
}
from
'
../remote/remoteConfig
'
;
import
{
SharedStorageService
}
from
'
../sharedStorage
'
...
...
ts/nni_manager/training_service/reusable/gpuScheduler.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
assert
from
'
assert
'
;
import
{
PlacementConstraint
}
from
'
common/trainingService
'
;
import
{
getLogger
,
Logger
}
from
'
../../
common/log
'
;
import
{
randomSelect
}
from
'
../../
common/utils
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
randomSelect
}
from
'
common/utils
'
;
import
{
GPUInfo
,
ScheduleResultType
}
from
'
../common/gpuData
'
;
import
{
EnvironmentInformation
}
from
'
./environment
'
;
import
{
RemoteMachineEnvironmentInformation
}
from
'
./remote/remoteConfig
'
;
...
...
@@ -232,6 +230,7 @@ export class GpuScheduler {
assert
(
false
,
'
gpuInfos is undefined
'
);
}
}
return
undefined
;
}
/**
...
...
ts/nni_manager/training_service/reusable/remote/remoteConfig.ts
View file @
5fc73ba6
...
...
@@ -2,7 +2,7 @@
// Licensed under the MIT license.
import
{
EnvironmentInformation
}
from
'
../environment
'
;
import
{
RemoteMachineConfig
}
from
'
../../../
common/experimentConfig
'
;
import
{
RemoteMachineConfig
}
from
'
common/experimentConfig
'
;
/**
* RemoteMachineEnvironmentInformation
...
...
ts/nni_manager/training_service/reusable/routerTrainingService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
{
getLogger
,
Logger
}
from
'
../../common/log
'
;
import
{
MethodNotImplementedError
}
from
'
../../common/errors
'
;
import
{
ExperimentConfig
,
RemoteConfig
,
OpenpaiConfig
,
KubeflowConfig
}
from
'
../../common/experimentConfig
'
;
import
{
TrainingService
,
TrialJobApplicationForm
,
TrialJobDetail
,
TrialJobMetric
}
from
'
../../common/trainingService
'
;
import
{
delay
}
from
'
../../common/utils
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
MethodNotImplementedError
}
from
'
common/errors
'
;
import
{
ExperimentConfig
,
RemoteConfig
,
OpenpaiConfig
,
KubeflowConfig
}
from
'
common/experimentConfig
'
;
import
{
TrainingService
,
TrialJobApplicationForm
,
TrialJobDetail
,
TrialJobMetric
}
from
'
common/trainingService
'
;
import
{
delay
}
from
'
common/utils
'
;
import
{
PAITrainingService
}
from
'
../pai/paiTrainingService
'
;
import
{
RemoteMachineTrainingService
}
from
'
../remote_machine/remoteMachineTrainingService
'
;
import
{
KubeflowTrainingService
}
from
'
../kubernetes/kubeflow/kubeflowTrainingService
'
;
...
...
ts/nni_manager/training_service/reusable/sharedStorage.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
{
SharedStorageConfig
}
from
'
../../common/experimentConfig
'
;
import
{
SharedStorageConfig
}
from
'
common/experimentConfig
'
;
import
{
StorageService
}
from
'
./storageService
'
export
type
SharedStorageType
=
'
NFS
'
|
'
AzureBlob
'
...
...
ts/nni_manager/training_service/reusable/shared_storages/azureblobStorageService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
cpp
from
'
child-process-promise
'
;
import
*
as
path
from
'
path
'
;
import
cpp
from
'
child-process-promise
'
;
import
path
from
'
path
'
;
import
{
SharedStorageService
,
SharedStorageType
}
from
'
../sharedStorage
'
import
{
MountedStorageService
}
from
'
../storages/mountedStorageService
'
;
import
{
getLogger
,
Logger
}
from
'
../../../
common/log
'
;
import
{
getExperimentId
}
from
'
../../../
common/experimentStartupInfo
'
;
import
{
AzureBlobConfig
}
from
'
../../../
common/experimentConfig
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
getExperimentId
}
from
'
common/experimentStartupInfo
'
;
import
{
AzureBlobConfig
}
from
'
common/experimentConfig
'
;
const
INSTALL_BLOBFUSE
=
`
#!/bin/bash
...
...
ts/nni_manager/training_service/reusable/shared_storages/nfsStorageService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
cpp
from
'
child-process-promise
'
;
import
*
as
path
from
'
path
'
;
import
cpp
from
'
child-process-promise
'
;
import
path
from
'
path
'
;
import
{
SharedStorageService
,
SharedStorageType
}
from
'
../sharedStorage
'
import
{
MountedStorageService
}
from
'
../storages/mountedStorageService
'
;
import
{
getLogger
,
Logger
}
from
'
../../../
common/log
'
;
import
{
getExperimentId
}
from
'
../../../
common/experimentStartupInfo
'
;
import
{
NfsConfig
}
from
'
../../../
common/experimentConfig
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
getExperimentId
}
from
'
common/experimentStartupInfo
'
;
import
{
NfsConfig
}
from
'
common/experimentConfig
'
;
const
INSTALL_NFS_CLIENT
=
`
#!/bin/bash
...
...
ts/nni_manager/training_service/reusable/storageService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
os
from
'
os
'
;
import
*
as
path
from
'
path
'
;
import
{
getLogger
,
Logger
}
from
'
../../common/log
'
;
import
{
uniqueString
}
from
'
../../common/utils
'
;
import
fs
from
'
fs
'
;
import
os
from
'
os
'
;
import
path
from
'
path
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
uniqueString
}
from
'
common/utils
'
;
import
{
tarAdd
}
from
'
../common/util
'
;
export
abstract
class
StorageService
{
...
...
ts/nni_manager/training_service/reusable/storages/mountedStorageService.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
{
Deferred
}
from
"
ts-deferred
"
;
import
{
StorageService
}
from
"
../storageService
"
;
...
...
ts/nni_manager/training_service/reusable/trial.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
{
TrialJobApplicationForm
,
TrialJobDetail
,
TrialJobStatus
}
from
"
../../common/trainingService
"
;
import
{
GPUInfo
}
from
"
../../training_service/common/gpuData
"
;
import
{
TrialJobApplicationForm
,
TrialJobDetail
,
TrialJobStatus
}
from
"
common/trainingService
"
;
import
{
GPUInfo
}
from
"
training_service/common/gpuData
"
;
import
{
EnvironmentInformation
,
NodeInformation
}
from
"
./environment
"
;
export
class
TrialDetail
implements
TrialJobDetail
{
...
...
ts/nni_manager/training_service/reusable/trialDispatcher.ts
View file @
5fc73ba6
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
'
use strict
'
;
import
{
EventEmitter
}
from
'
events
'
;
import
*
as
fs
from
'
fs
'
;
import
*
as
path
from
'
path
'
;
import
fs
from
'
fs
'
;
import
path
from
'
path
'
;
import
{
Writable
}
from
'
stream
'
;
import
{
Container
,
Scope
}
from
'
typescript-ioc
'
;
import
{
String
}
from
'
typescript-string-operations
'
;
import
*
as
component
from
'
../../
common/component
'
;
import
{
NNIError
,
NNIErrorNames
,
MethodNotImplementedError
}
from
'
../../
common/errors
'
;
import
{
getBasePort
,
getExperimentId
}
from
'
../../
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
../../
common/log
'
;
import
{
TrainingService
,
TrialJobApplicationForm
,
TrialJobMetric
,
TrialJobStatus
}
from
'
../../
common/trainingService
'
;
import
{
delay
,
getExperimentRootDir
,
getIPV4Address
,
getLogLevel
,
getVersion
,
mkDirPSync
,
randomSelect
,
uniqueString
}
from
'
../../
common/utils
'
;
import
{
ExperimentConfig
,
SharedStorageConfig
}
from
'
../../
common/experimentConfig
'
;
import
{
GPU_INFO
,
INITIALIZED
,
KILL_TRIAL_JOB
,
NEW_TRIAL_JOB
,
REPORT_METRIC_DATA
,
SEND_TRIAL_JOB_PARAMETER
,
STDOUT
,
TRIAL_END
,
VERSION_CHECK
}
from
'
../../
core/commands
'
;
import
{
ScheduleResultType
}
from
'
../../
training_service/common/gpuData
'
;
import
*
as
component
from
'
common/component
'
;
import
{
NNIError
,
NNIErrorNames
,
MethodNotImplementedError
}
from
'
common/errors
'
;
import
{
getBasePort
,
getExperimentId
}
from
'
common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
common/log
'
;
import
{
TrainingService
,
TrialJobApplicationForm
,
TrialJobMetric
,
TrialJobStatus
}
from
'
common/trainingService
'
;
import
{
delay
,
getExperimentRootDir
,
getIPV4Address
,
getLogLevel
,
getVersion
,
mkDirPSync
,
randomSelect
,
uniqueString
}
from
'
common/utils
'
;
import
{
ExperimentConfig
,
SharedStorageConfig
}
from
'
common/experimentConfig
'
;
import
{
GPU_INFO
,
INITIALIZED
,
KILL_TRIAL_JOB
,
NEW_TRIAL_JOB
,
REPORT_METRIC_DATA
,
SEND_TRIAL_JOB_PARAMETER
,
STDOUT
,
TRIAL_END
,
VERSION_CHECK
}
from
'
core/commands
'
;
import
{
ScheduleResultType
}
from
'
training_service/common/gpuData
'
;
import
{
CONTAINER_INSTALL_NNI_SHELL_FORMAT
}
from
'
../common/containerJobData
'
;
import
{
CONTAINER_INSTALL_NNI_SHELL_FORMAT_FOR_WIN
}
from
'
../common/containerJobData
'
;
import
{
TrialConfig
}
from
'
../common/trialConfig
'
;
...
...
ts/nni_manager/tsconfig.json
View file @
5fc73ba6
{
"include"
:
[
"common/**/*"
,
"core/**/*"
,
"rest_server/**/*"
,
"training_service/**/*"
,
"main.ts"
],
"compilerOptions"
:
{
"target"
:
"ESNext"
,
"module"
:
"CommonJS"
,
"removeComments"
:
true
,
"allowUnreachableCode"
:
false
,
"noImplicitReturns"
:
true
,
"noPropertyAccessFromIndexSignature"
:
true
,
"noUnusedParameters"
:
true
,
"strict"
:
true
,
"noImplicitAny"
:
true
,
"baseUrl"
:
"."
,
"outDir"
:
"dist"
,
"experimentalDecorators"
:
true
,
"emitDecoratorMetadata"
:
true
,
"module"
:
"CommonJS"
,
"typeRoots"
:
[
"node_modules/@types"
,
"types"
]
},
"exclude"
:
[
"node_modules"
,
"test"
]
],
"outDir"
:
"dist"
,
"removeComments"
:
true
,
"allowSyntheticDefaultImports"
:
true
,
"esModuleInterop"
:
true
,
"emitDecoratorMetadata"
:
true
,
"experimentalDecorators"
:
true
,
"target"
:
"ESNext"
,
"incremental"
:
true
,
"tsBuildInfoFile"
:
"./.tsbuildinfo"
}
}
Prev
1
2
3
4
5
6
7
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment