Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
d48ad027
Unverified
Commit
d48ad027
authored
Jun 20, 2019
by
SparkSnail
Committed by
GitHub
Jun 20, 2019
Browse files
Merge pull request #184 from microsoft/master
merge master
parents
9352cc88
22993e5d
Changes
187
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
73 additions
and
74 deletions
+73
-74
examples/trials/network_morphism/cifar10/config.yml
examples/trials/network_morphism/cifar10/config.yml
+1
-1
examples/trials/network_morphism/cifar10/config_pai.yml
examples/trials/network_morphism/cifar10/config_pai.yml
+1
-1
examples/trials/sklearn/classification/main.py
examples/trials/sklearn/classification/main.py
+1
-1
examples/trials/sklearn/regression/main.py
examples/trials/sklearn/regression/main.py
+2
-2
examples/trials/weight_sharing/ga_squad/config_remote.yml
examples/trials/weight_sharing/ga_squad/config_remote.yml
+3
-3
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
+1
-1
examples/tuners/ga_customer_tuner/README.md
examples/tuners/ga_customer_tuner/README.md
+2
-2
examples/tuners/weight_sharing/ga_customer_tuner/README.md
examples/tuners/weight_sharing/ga_customer_tuner/README.md
+2
-2
src/nni_manager/common/restServer.ts
src/nni_manager/common/restServer.ts
+5
-5
src/nni_manager/common/trainingService.ts
src/nni_manager/common/trainingService.ts
+1
-2
src/nni_manager/common/utils.ts
src/nni_manager/common/utils.ts
+6
-6
src/nni_manager/config/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
...ig/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
+8
-8
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
+8
-8
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
+8
-8
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
+8
-8
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
+8
-8
src/nni_manager/core/nnimanager.ts
src/nni_manager/core/nnimanager.ts
+2
-2
src/nni_manager/core/test/ipcInterface.test.ts
src/nni_manager/core/test/ipcInterface.test.ts
+3
-3
src/nni_manager/core/test/mockedTrainingService.ts
src/nni_manager/core/test/mockedTrainingService.ts
+2
-2
src/nni_manager/core/test/nnimanager.test.ts
src/nni_manager/core/test/nnimanager.test.ts
+1
-1
No files found.
examples/trials/network_morphism/cifar10/config.yml
View file @
d48ad027
...
@@ -10,7 +10,7 @@ trainingServicePlatform: local
...
@@ -10,7 +10,7 @@ trainingServicePlatform: local
useAnnotation
:
false
useAnnotation
:
false
tuner
:
tuner
:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
#SMAC (SMAC should be installed through nnictl)
builtinTunerName
:
NetworkMorphism
builtinTunerName
:
NetworkMorphism
classArgs
:
classArgs
:
#choice: maximize, minimize
#choice: maximize, minimize
...
...
examples/trials/network_morphism/cifar10/config_pai.yml
View file @
d48ad027
...
@@ -9,7 +9,7 @@ trainingServicePlatform: pai
...
@@ -9,7 +9,7 @@ trainingServicePlatform: pai
useAnnotation
:
false
useAnnotation
:
false
tuner
:
tuner
:
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#choice: TPE, Random, Anneal, Evolution, BatchTuner, NetworkMorphism
#SMAC (SMAC should be installed through nnictl)
#SMAC (SMAC should be installed through nnictl)
builtinTunerName
:
NetworkMorphism
builtinTunerName
:
NetworkMorphism
classArgs
:
classArgs
:
#choice: maximize, minimize
#choice: maximize, minimize
...
...
examples/trials/sklearn/classification/main.py
View file @
d48ad027
...
@@ -56,7 +56,7 @@ def get_model(PARAMS):
...
@@ -56,7 +56,7 @@ def get_model(PARAMS):
model
.
degree
=
PARAMS
.
get
(
'degree'
)
model
.
degree
=
PARAMS
.
get
(
'degree'
)
model
.
gamma
=
PARAMS
.
get
(
'gamma'
)
model
.
gamma
=
PARAMS
.
get
(
'gamma'
)
model
.
coef0
=
PARAMS
.
get
(
'coef0'
)
model
.
coef0
=
PARAMS
.
get
(
'coef0'
)
return
model
return
model
def
run
(
X_train
,
X_test
,
y_train
,
y_test
,
PARAMS
):
def
run
(
X_train
,
X_test
,
y_train
,
y_test
,
PARAMS
):
...
...
examples/trials/sklearn/regression/main.py
View file @
d48ad027
...
@@ -63,9 +63,9 @@ def get_model(PARAMS):
...
@@ -63,9 +63,9 @@ def get_model(PARAMS):
if
not
model_dict
.
get
(
PARAMS
[
'model_name'
]):
if
not
model_dict
.
get
(
PARAMS
[
'model_name'
]):
LOG
.
exception
(
'Not supported model!'
)
LOG
.
exception
(
'Not supported model!'
)
exit
(
1
)
exit
(
1
)
model
=
model_dict
[
PARAMS
[
'model_name'
]]
model
=
model_dict
[
PARAMS
[
'model_name'
]]
try
:
try
:
if
PARAMS
[
'model_name'
]
==
'SVR'
:
if
PARAMS
[
'model_name'
]
==
'SVR'
:
model
.
kernel
=
PARAMS
[
'svr_kernel'
]
model
.
kernel
=
PARAMS
[
'svr_kernel'
]
...
...
examples/trials/weight_sharing/ga_squad/config_remote.yml
View file @
d48ad027
...
@@ -10,7 +10,7 @@ useAnnotation: false
...
@@ -10,7 +10,7 @@ useAnnotation: false
multiThread
:
true
multiThread
:
true
tuner
:
tuner
:
codeDir
:
../../../tuners/weight_sharing/ga_customer_tuner
codeDir
:
../../../tuners/weight_sharing/ga_customer_tuner
classFileName
:
customer_tuner.py
classFileName
:
customer_tuner.py
className
:
CustomerTuner
className
:
CustomerTuner
classArgs
:
classArgs
:
optimize_mode
:
maximize
optimize_mode
:
maximize
...
@@ -23,9 +23,9 @@ trial:
...
@@ -23,9 +23,9 @@ trial:
machineList
:
machineList
:
-
ip
:
remote-ip-0
-
ip
:
remote-ip-0
port
:
8022
port
:
8022
username
:
root
username
:
root
passwd
:
screencast
passwd
:
screencast
-
ip
:
remote-ip-1
-
ip
:
remote-ip-1
port
:
8022
port
:
8022
username
:
root
username
:
root
passwd
:
screencast
passwd
:
screencast
examples/trials/weight_sharing/ga_squad/graph_to_tf.py
View file @
d48ad027
...
@@ -290,7 +290,7 @@ def graph_to_network(input1,
...
@@ -290,7 +290,7 @@ def graph_to_network(input1,
if
topo_i
==
'|'
:
if
topo_i
==
'|'
:
continue
continue
# Note: here we use the `hash_id` of layer as scope name,
# Note: here we use the `hash_id` of layer as scope name,
# so that we can automatically load sharable weights from previous trained models
# so that we can automatically load sharable weights from previous trained models
with
tf
.
variable_scope
(
p_graph
.
layers
[
topo_i
].
hash_id
,
reuse
=
tf
.
AUTO_REUSE
):
with
tf
.
variable_scope
(
p_graph
.
layers
[
topo_i
].
hash_id
,
reuse
=
tf
.
AUTO_REUSE
):
if
p_graph
.
layers
[
topo_i
].
graph_type
==
LayerType
.
input
.
value
:
if
p_graph
.
layers
[
topo_i
].
graph_type
==
LayerType
.
input
.
value
:
...
...
examples/tuners/ga_customer_tuner/README.md
View file @
d48ad027
# How to use ga_customer_tuner?
# How to use ga_customer_tuner?
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
# config
# config
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
```
```
...
...
examples/tuners/weight_sharing/ga_customer_tuner/README.md
View file @
d48ad027
# How to use ga_customer_tuner?
# How to use ga_customer_tuner?
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
This tuner is a customized tuner which only suitable for trial whose code path is "~/nni/examples/trials/ga_squad",
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
type
`cd ~/nni/examples/trials/ga_squad`
and check readme.md to get more information for ga_squad trial.
# config
# config
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
If you want to use ga_customer_tuner in your experiment, you could set config file as following format:
```
```
...
...
src/nni_manager/common/restServer.ts
View file @
d48ad027
...
@@ -29,7 +29,7 @@ import { getBasePort } from './experimentStartupInfo';
...
@@ -29,7 +29,7 @@ import { getBasePort } from './experimentStartupInfo';
/**
/**
* Abstraction class to create a RestServer
* Abstraction class to create a RestServer
* The module who wants to use a RestServer could <b>extends</b> this abstract class
* The module who wants to use a RestServer could <b>extends</b> this abstract class
* And implement its own registerRestHandler() function to register routers
* And implement its own registerRestHandler() function to register routers
*/
*/
export
abstract
class
RestServer
{
export
abstract
class
RestServer
{
...
@@ -43,7 +43,7 @@ export abstract class RestServer {
...
@@ -43,7 +43,7 @@ export abstract class RestServer {
protected
app
:
express
.
Application
=
express
();
protected
app
:
express
.
Application
=
express
();
protected
log
:
Logger
=
getLogger
();
protected
log
:
Logger
=
getLogger
();
protected
basePort
?:
number
;
protected
basePort
?:
number
;
constructor
()
{
constructor
()
{
this
.
port
=
getBasePort
();
this
.
port
=
getBasePort
();
assert
(
this
.
port
&&
this
.
port
>
1024
);
assert
(
this
.
port
&&
this
.
port
>
1024
);
...
@@ -91,9 +91,9 @@ export abstract class RestServer {
...
@@ -91,9 +91,9 @@ export abstract class RestServer {
}
else
{
}
else
{
this
.
startTask
.
promise
.
then
(
this
.
startTask
.
promise
.
then
(
()
=>
{
// Started
()
=>
{
// Started
//Stops the server from accepting new connections and keeps existing connections.
//Stops the server from accepting new connections and keeps existing connections.
//This function is asynchronous, the server is finally closed when all connections
//This function is asynchronous, the server is finally closed when all connections
//are ended and the server emits a 'close' event.
//are ended and the server emits a 'close' event.
//Refer https://nodejs.org/docs/latest/api/net.html#net_server_close_callback
//Refer https://nodejs.org/docs/latest/api/net.html#net_server_close_callback
this
.
server
.
close
().
on
(
'
close
'
,
()
=>
{
this
.
server
.
close
().
on
(
'
close
'
,
()
=>
{
this
.
log
.
info
(
'
Rest server stopped.
'
);
this
.
log
.
info
(
'
Rest server stopped.
'
);
...
...
src/nni_manager/common/trainingService.ts
View file @
d48ad027
...
@@ -91,6 +91,7 @@ interface TrialJobMetric {
...
@@ -91,6 +91,7 @@ interface TrialJobMetric {
* define TrainingServiceError
* define TrainingServiceError
*/
*/
class
TrainingServiceError
extends
Error
{
class
TrainingServiceError
extends
Error
{
private
errCode
:
number
;
private
errCode
:
number
;
constructor
(
errorCode
:
number
,
errorMessage
:
string
)
{
constructor
(
errorCode
:
number
,
errorMessage
:
string
)
{
...
@@ -136,5 +137,3 @@ export {
...
@@ -136,5 +137,3 @@ export {
TrainingServiceMetadata
,
TrialJobDetail
,
TrialJobMetric
,
HyperParameters
,
TrainingServiceMetadata
,
TrialJobDetail
,
TrialJobMetric
,
HyperParameters
,
HostJobApplicationForm
,
JobApplicationForm
,
JobType
,
NNIManagerIpConfig
HostJobApplicationForm
,
JobApplicationForm
,
JobType
,
NNIManagerIpConfig
};
};
src/nni_manager/common/utils.ts
View file @
d48ad027
...
@@ -167,7 +167,7 @@ function getCmdPy(): string {
...
@@ -167,7 +167,7 @@ function getCmdPy(): string {
}
}
/**
/**
* Generate command line to start automl algorithm(s),
* Generate command line to start automl algorithm(s),
* either start advisor or start a process which runs tuner and assessor
* either start advisor or start a process which runs tuner and assessor
* @param tuner : For builtin tuner:
* @param tuner : For builtin tuner:
* {
* {
...
@@ -361,11 +361,11 @@ function countFilesRecursively(directory: string, timeoutMilliSeconds?: number):
...
@@ -361,11 +361,11 @@ function countFilesRecursively(directory: string, timeoutMilliSeconds?: number):
if
(
process
.
platform
===
"
win32
"
)
{
if
(
process
.
platform
===
"
win32
"
)
{
cmd
=
`powershell "Get-ChildItem -Path
${
directory
}
-Recurse -File | Measure-Object | %{$_.Count}"`
cmd
=
`powershell "Get-ChildItem -Path
${
directory
}
-Recurse -File | Measure-Object | %{$_.Count}"`
}
else
{
}
else
{
cmd
=
`find
${
directory
}
-type f | wc -l`
;
cmd
=
`find
${
directory
}
-type f | wc -l`
;
}
}
cpp
.
exec
(
cmd
).
then
((
result
)
=>
{
cpp
.
exec
(
cmd
).
then
((
result
)
=>
{
if
(
result
.
stdout
&&
parseInt
(
result
.
stdout
))
{
if
(
result
.
stdout
&&
parseInt
(
result
.
stdout
))
{
fileCount
=
parseInt
(
result
.
stdout
);
fileCount
=
parseInt
(
result
.
stdout
);
}
}
deferred
.
resolve
(
fileCount
);
deferred
.
resolve
(
fileCount
);
});
});
...
@@ -385,7 +385,7 @@ async function getVersion(): Promise<string> {
...
@@ -385,7 +385,7 @@ async function getVersion(): Promise<string> {
deferred
.
reject
(
error
);
deferred
.
reject
(
error
);
});
});
return
deferred
.
promise
;
return
deferred
.
promise
;
}
}
/**
/**
* run command as ChildProcess
* run command as ChildProcess
...
@@ -437,7 +437,7 @@ async function isAlive(pid:any): Promise<boolean> {
...
@@ -437,7 +437,7 @@ async function isAlive(pid:any): Promise<boolean> {
}
}
/**
/**
* kill process
* kill process
*/
*/
async
function
killPid
(
pid
:
any
):
Promise
<
void
>
{
async
function
killPid
(
pid
:
any
):
Promise
<
void
>
{
let
deferred
:
Deferred
<
void
>
=
new
Deferred
<
void
>
();
let
deferred
:
Deferred
<
void
>
=
new
Deferred
<
void
>
();
...
@@ -466,7 +466,7 @@ function getNewLine(): string {
...
@@ -466,7 +466,7 @@ function getNewLine(): string {
/**
/**
* Use '/' to join path instead of '\' for all kinds of platform
* Use '/' to join path instead of '\' for all kinds of platform
* @param path
* @param path
*/
*/
function
unixPathJoin
(...
paths
:
any
[]):
string
{
function
unixPathJoin
(...
paths
:
any
[]):
string
{
const
dir
:
string
=
paths
.
filter
((
path
:
any
)
=>
path
!==
''
).
join
(
'
/
'
);
const
dir
:
string
=
paths
.
filter
((
path
:
any
)
=>
path
!==
''
).
join
(
'
/
'
);
...
...
src/nni_manager/config/frameworkcontroller/frameworkcontrollerjob-crd-v1.json
View file @
d48ad027
{
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"spec"
:
{
"scope"
:
"Namespaced"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1"
,
"version"
:
"v1"
,
"group"
:
"frameworkcontroller.microsoft.com"
,
"group"
:
"frameworkcontroller.microsoft.com"
,
"names"
:
{
"names"
:
{
"kind"
:
"Framework"
,
"kind"
:
"Framework"
,
"plural"
:
"frameworks"
,
"plural"
:
"frameworks"
,
"singular"
:
"framework"
"singular"
:
"framework"
}
}
},
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"metadata"
:
{
"name"
:
"frameworks.frameworkcontroller.microsoft.com"
"name"
:
"frameworks.frameworkcontroller.microsoft.com"
}
}
...
...
src/nni_manager/config/kubeflow/pytorchjob-crd-v1alpha2.json
View file @
d48ad027
{
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"spec"
:
{
"scope"
:
"Namespaced"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"names"
:
{
"kind"
:
"PyTorchJob"
,
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"plural"
:
"pytorchjobs"
,
"singular"
:
"pytorchjob"
"singular"
:
"pytorchjob"
}
}
},
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"metadata"
:
{
"name"
:
"pytorchjobs.kubeflow.org"
"name"
:
"pytorchjobs.kubeflow.org"
}
}
...
...
src/nni_manager/config/kubeflow/pytorchjob-crd-v1beta1.json
View file @
d48ad027
{
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"spec"
:
{
"scope"
:
"Namespaced"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"names"
:
{
"kind"
:
"PyTorchJob"
,
"kind"
:
"PyTorchJob"
,
"plural"
:
"pytorchjobs"
,
"plural"
:
"pytorchjobs"
,
"singular"
:
"pytorchjob"
"singular"
:
"pytorchjob"
}
}
},
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"metadata"
:
{
"name"
:
"pytorchjobs.kubeflow.org"
"name"
:
"pytorchjobs.kubeflow.org"
}
}
...
...
src/nni_manager/config/kubeflow/tfjob-crd-v1alpha2.json
View file @
d48ad027
{
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"spec"
:
{
"scope"
:
"Namespaced"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1alpha2"
,
"version"
:
"v1alpha2"
,
"group"
:
"kubeflow.org"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"names"
:
{
"kind"
:
"TFJob"
,
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"plural"
:
"tfjobs"
,
"singular"
:
"tfjob"
"singular"
:
"tfjob"
}
}
},
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"metadata"
:
{
"name"
:
"tfjobs.kubeflow.org"
"name"
:
"tfjobs.kubeflow.org"
}
}
...
...
src/nni_manager/config/kubeflow/tfjob-crd-v1beta1.json
View file @
d48ad027
{
{
"kind"
:
"CustomResourceDefinition"
,
"kind"
:
"CustomResourceDefinition"
,
"spec"
:
{
"spec"
:
{
"scope"
:
"Namespaced"
,
"scope"
:
"Namespaced"
,
"version"
:
"v1beta1"
,
"version"
:
"v1beta1"
,
"group"
:
"kubeflow.org"
,
"group"
:
"kubeflow.org"
,
"names"
:
{
"names"
:
{
"kind"
:
"TFJob"
,
"kind"
:
"TFJob"
,
"plural"
:
"tfjobs"
,
"plural"
:
"tfjobs"
,
"singular"
:
"tfjob"
"singular"
:
"tfjob"
}
}
},
},
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"apiVersion"
:
"apiextensions.k8s.io/v1beta1"
,
"metadata"
:
{
"metadata"
:
{
"name"
:
"tfjobs.kubeflow.org"
"name"
:
"tfjobs.kubeflow.org"
}
}
...
...
src/nni_manager/core/nnimanager.ts
View file @
d48ad027
...
@@ -159,7 +159,7 @@ class NNIManager implements Manager {
...
@@ -159,7 +159,7 @@ class NNIManager implements Manager {
if
(
expParams
.
logCollection
!==
undefined
)
{
if
(
expParams
.
logCollection
!==
undefined
)
{
this
.
trainingService
.
setClusterMetadata
(
'
log_collection
'
,
expParams
.
logCollection
.
toString
());
this
.
trainingService
.
setClusterMetadata
(
'
log_collection
'
,
expParams
.
logCollection
.
toString
());
}
}
const
dispatcherCommand
:
string
=
getMsgDispatcherCommand
(
expParams
.
tuner
,
expParams
.
assessor
,
expParams
.
advisor
,
const
dispatcherCommand
:
string
=
getMsgDispatcherCommand
(
expParams
.
tuner
,
expParams
.
assessor
,
expParams
.
advisor
,
expParams
.
multiPhase
,
expParams
.
multiThread
);
expParams
.
multiPhase
,
expParams
.
multiThread
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
this
.
log
.
debug
(
`dispatcher command:
${
dispatcherCommand
}
`
);
...
@@ -493,7 +493,7 @@ class NNIManager implements Manager {
...
@@ -493,7 +493,7 @@ class NNIManager implements Manager {
// If trialConcurrency does not change, requestTrialNum equals finishedTrialJobNum.
// If trialConcurrency does not change, requestTrialNum equals finishedTrialJobNum.
// If trialConcurrency changes, for example, trialConcurrency increases by 2 (trialConcurrencyChange=2), then
// If trialConcurrency changes, for example, trialConcurrency increases by 2 (trialConcurrencyChange=2), then
// requestTrialNum equals 2 + finishedTrialJobNum and trialConcurrencyChange becomes 0.
// requestTrialNum equals 2 + finishedTrialJobNum and trialConcurrencyChange becomes 0.
// If trialConcurrency changes, for example, trialConcurrency decreases by 4 (trialConcurrencyChange=-4) and
// If trialConcurrency changes, for example, trialConcurrency decreases by 4 (trialConcurrencyChange=-4) and
// finishedTrialJobNum is 2, then requestTrialNum becomes -2. No trial will be requested from tuner,
// finishedTrialJobNum is 2, then requestTrialNum becomes -2. No trial will be requested from tuner,
// and trialConcurrencyChange becomes -2.
// and trialConcurrencyChange becomes -2.
const
requestTrialNum
:
number
=
this
.
trialConcurrencyChange
+
finishedTrialJobNum
;
const
requestTrialNum
:
number
=
this
.
trialConcurrencyChange
+
finishedTrialJobNum
;
...
...
src/nni_manager/core/test/ipcInterface.test.ts
View file @
d48ad027
...
@@ -46,11 +46,11 @@ function runProcess(): Promise<Error | null> {
...
@@ -46,11 +46,11 @@ function runProcess(): Promise<Error | null> {
if
(
code
!==
0
)
{
if
(
code
!==
0
)
{
deferred
.
resolve
(
new
Error
(
`return code:
${
code
}
`
));
deferred
.
resolve
(
new
Error
(
`return code:
${
code
}
`
));
}
else
{
}
else
{
let
str
=
proc
.
stdout
.
read
().
toString
();
let
str
=
proc
.
stdout
.
read
().
toString
();
if
(
str
.
search
(
"
\r\n
"
)
!=-
1
){
if
(
str
.
search
(
"
\r\n
"
)
!=-
1
){
sentCommands
=
str
.
split
(
"
\r\n
"
);
sentCommands
=
str
.
split
(
"
\r\n
"
);
}
}
else
{
else
{
sentCommands
=
str
.
split
(
'
\n
'
);
sentCommands
=
str
.
split
(
'
\n
'
);
}
}
deferred
.
resolve
(
null
);
deferred
.
resolve
(
null
);
...
@@ -76,7 +76,7 @@ function runProcess(): Promise<Error | null> {
...
@@ -76,7 +76,7 @@ function runProcess(): Promise<Error | null> {
commandTooLong
=
error
;
commandTooLong
=
error
;
}
}
// Command #4: FE is not tuner/assessor command, test the exception type of send non-valid command
// Command #4: FE is not tuner/assessor command, test the exception type of send non-valid command
try
{
try
{
dispatcher
.
sendCommand
(
'
FE
'
,
'
1
'
);
dispatcher
.
sendCommand
(
'
FE
'
,
'
1
'
);
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
src/nni_manager/core/test/mockedTrainingService.ts
View file @
d48ad027
...
@@ -59,10 +59,10 @@ class MockedTrainingService extends TrainingService {
...
@@ -59,10 +59,10 @@ class MockedTrainingService extends TrainingService {
},
},
sequenceId
:
0
sequenceId
:
0
};
};
public
listTrialJobs
():
Promise
<
TrialJobDetail
[]
>
{
public
listTrialJobs
():
Promise
<
TrialJobDetail
[]
>
{
const
deferred
=
new
Deferred
<
TrialJobDetail
[]
>
();
const
deferred
=
new
Deferred
<
TrialJobDetail
[]
>
();
deferred
.
resolve
([
this
.
jobDetail1
,
this
.
jobDetail2
]);
deferred
.
resolve
([
this
.
jobDetail1
,
this
.
jobDetail2
]);
return
deferred
.
promise
;
return
deferred
.
promise
;
}
}
...
...
src/nni_manager/core/test/nnimanager.test.ts
View file @
d48ad027
...
@@ -104,7 +104,7 @@ describe('Unit test for nnimanager', function () {
...
@@ -104,7 +104,7 @@ describe('Unit test for nnimanager', function () {
maxSequenceId
:
0
,
maxSequenceId
:
0
,
revision
:
0
revision
:
0
}
}
before
(
async
()
=>
{
before
(
async
()
=>
{
await
initContainer
();
await
initContainer
();
...
...
Prev
1
2
3
4
5
6
7
8
…
10
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