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
1fec96c9
Unverified
Commit
1fec96c9
authored
Jan 03, 2019
by
QuanluZhang
Committed by
GitHub
Jan 03, 2019
Browse files
fix state transition (#504)
parent
d5f808b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
15 deletions
+19
-15
src/nni_manager/common/manager.ts
src/nni_manager/common/manager.ts
+1
-1
src/nni_manager/core/nnimanager.ts
src/nni_manager/core/nnimanager.ts
+18
-14
No files found.
src/nni_manager/common/manager.ts
View file @
1fec96c9
...
...
@@ -85,7 +85,7 @@ interface TrialJobStatistics {
}
interface
NNIManagerStatus
{
status
:
'
INITIALIZED
'
|
'
RUNNING
'
|
'
ERROR
'
|
'
STOPPING
'
|
'
STOPPED
'
|
'
DONE
'
|
'
NO_MORE_TRIAL
'
;
status
:
'
INITIALIZED
'
|
'
RUNNING
'
|
'
ERROR
'
|
'
STOPPING
'
|
'
STOPPED
'
|
'
DONE
'
|
'
NO_MORE_TRIAL
'
|
'
TUNER_NO_MORE_TRIAL
'
;
errors
:
string
[];
}
...
...
src/nni_manager/core/nnimanager.ts
View file @
1fec96c9
...
...
@@ -425,14 +425,10 @@ class NNIManager implements Manager {
throw
new
Error
(
'
Error: tuner has not been setup
'
);
}
let
allFinishedTrialJobNum
:
number
=
0
;
let
waitSubmittedToFinish
:
number
;
while
(
this
.
status
.
status
!==
'
STOPPING
'
&&
this
.
status
.
status
!==
'
STOPPED
'
)
{
const
finishedTrialJobNum
:
number
=
await
this
.
requestTrialJobsStatus
();
allFinishedTrialJobNum
+=
finishedTrialJobNum
;
if
(
allFinishedTrialJobNum
>=
this
.
experimentProfile
.
params
.
maxTrialNum
)
{
// write this log for travis CI
this
.
log
.
info
(
'
Experiment done.
'
);
}
// requestTrialNum is the number of trials that will be requested from tuner.
// If trialConcurrency does not change, requestTrialNum equals finishedTrialJobNum.
...
...
@@ -467,21 +463,29 @@ class NNIManager implements Manager {
// as still running. DONE could be transfered from RUNNING or NO_MORE_TRIAL.
assert
(
this
.
status
.
status
===
'
RUNNING
'
||
this
.
status
.
status
===
'
DONE
'
||
this
.
status
.
status
===
'
NO_MORE_TRIAL
'
);
this
.
status
.
status
===
'
NO_MORE_TRIAL
'
||
this
.
status
.
status
===
'
TUNER_NO_MORE_TRIAL
'
);
if
(
this
.
experimentProfile
.
execDuration
>
this
.
experimentProfile
.
params
.
maxExecDuration
||
this
.
currSubmittedTrialNum
>=
this
.
experimentProfile
.
params
.
maxTrialNum
)
{
if
(
this
.
status
.
status
===
'
RUNNING
'
||
this
.
status
.
status
===
'
NO_MORE_TRIAL
'
)
{
this
.
experimentProfile
.
endTime
=
Date
.
now
();
await
this
.
storeExperimentProfile
();
if
(
this
.
status
.
status
!==
'
DONE
'
)
{
this
.
status
.
status
=
'
NO_MORE_TRIAL
'
;
waitSubmittedToFinish
=
this
.
currSubmittedTrialNum
;
assert
(
allFinishedTrialJobNum
<=
waitSubmittedToFinish
);
if
(
allFinishedTrialJobNum
>=
waitSubmittedToFinish
)
{
this
.
status
.
status
=
'
DONE
'
;
this
.
experimentProfile
.
endTime
=
Date
.
now
();
await
this
.
storeExperimentProfile
();
// write this log for travis CI
this
.
log
.
info
(
'
Experiment done.
'
);
}
}
this
.
status
.
status
=
'
DONE
'
;
}
else
{
if
(
this
.
status
.
status
===
'
DONE
'
)
{
delete
this
.
experimentProfile
.
endTime
;
await
this
.
storeExperimentProfile
();
}
if
(
this
.
status
.
status
!==
'
NO_MORE_TRIAL
'
)
{
if
(
this
.
status
.
status
!==
'
TUNER_
NO_MORE_TRIAL
'
)
{
this
.
status
.
status
=
'
RUNNING
'
;
}
for
(
let
i
:
number
=
this
.
trialJobs
.
size
;
i
<
this
.
experimentProfile
.
params
.
trialConcurrency
;
i
++
)
{
...
...
@@ -602,7 +606,7 @@ class NNIManager implements Manager {
this
.
requestTrialJobs
(
this
.
experimentProfile
.
params
.
trialConcurrency
);
break
;
case
NEW_TRIAL_JOB
:
if
(
this
.
status
.
status
===
'
NO_MORE_TRIAL
'
)
{
if
(
this
.
status
.
status
===
'
TUNER_
NO_MORE_TRIAL
'
)
{
this
.
log
.
warning
(
'
It is not supposed to receive more trials after NO_MORE_TRIAL is set
'
);
this
.
status
.
status
=
'
RUNNING
'
;
}
...
...
@@ -625,7 +629,7 @@ class NNIManager implements Manager {
'
ADD_HYPERPARAMETER
'
,
tunerCommand
.
trial_job_id
,
content
,
undefined
);
break
;
case
NO_MORE_TRIAL_JOBS
:
this
.
status
.
status
=
'
NO_MORE_TRIAL
'
;
this
.
status
.
status
=
'
TUNER_
NO_MORE_TRIAL
'
;
break
;
case
KILL_TRIAL_JOB
:
await
this
.
trainingService
.
cancelTrialJob
(
JSON
.
parse
(
content
),
true
);
...
...
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