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
bd346816
Unverified
Commit
bd346816
authored
Mar 26, 2019
by
SparkSnail
Committed by
GitHub
Mar 26, 2019
Browse files
Fix localTrainingService stream (#885)
parent
892c9c4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
5 deletions
+17
-5
src/nni_manager/training_service/local/localTrainingService.ts
...ni_manager/training_service/local/localTrainingService.ts
+16
-5
src/nni_manager/training_service/local/localTrainingServiceForGPU.ts
...ager/training_service/local/localTrainingServiceForGPU.ts
+1
-0
No files found.
src/nni_manager/training_service/local/localTrainingService.ts
View file @
bd346816
...
...
@@ -103,7 +103,7 @@ class LocalTrainingService implements TrainingService {
protected
log
:
Logger
;
protected
localTrailConfig
?:
TrialConfig
;
private
isMultiPhase
:
boolean
=
false
;
pr
ivate
streams
:
Array
<
ts
.
Stream
>
;
pr
otected
jobStreamMap
:
Map
<
string
,
ts
.
Stream
>
;
constructor
()
{
this
.
eventEmitter
=
new
EventEmitter
();
...
...
@@ -113,7 +113,7 @@ class LocalTrainingService implements TrainingService {
this
.
stopping
=
false
;
this
.
log
=
getLogger
();
this
.
trialSequenceId
=
-
1
;
this
.
s
tream
s
=
new
Array
<
ts
.
Stream
>
();
this
.
jobS
tream
Map
=
new
Map
<
string
,
ts
.
Stream
>
();
this
.
log
.
info
(
'
Construct local machine training service.
'
);
}
...
...
@@ -307,14 +307,24 @@ class LocalTrainingService implements TrainingService {
public
cleanUp
():
Promise
<
void
>
{
this
.
log
.
info
(
'
Stopping local machine training service...
'
);
this
.
stopping
=
true
;
for
(
const
stream
of
this
.
s
tream
s
)
{
for
(
const
stream
of
this
.
jobS
tream
Map
.
values
()
)
{
stream
.
destroy
();
}
return
Promise
.
resolve
();
}
protected
onTrialJobStatusChanged
(
trialJob
:
TrialJobDetail
,
oldStatus
:
TrialJobStatus
):
void
{
//abstract
//if job is not running, destory job stream
if
([
'
SUCCEEDED
'
,
'
FAILED
'
,
'
USER_CANCELED
'
,
'
SYS_CANCELED
'
,
'
EARLY_STOPPED
'
].
includes
(
trialJob
.
status
))
{
if
(
this
.
jobStreamMap
.
has
(
trialJob
.
id
))
{
const
stream
=
this
.
jobStreamMap
.
get
(
trialJob
.
id
);
if
(
!
stream
)
{
throw
new
Error
(
`Could not find stream in trial
${
trialJob
.
id
}
`
);
}
stream
.
destroy
();
this
.
jobStreamMap
.
delete
(
trialJob
.
id
);
}
}
}
protected
getEnvironmentVariables
(
trialJobDetail
:
TrialJobDetail
,
_
:
{}):
{
key
:
string
;
value
:
string
}[]
{
...
...
@@ -396,7 +406,8 @@ class LocalTrainingService implements TrainingService {
buffer
=
remain
;
}
});
this
.
streams
.
push
(
stream
);
this
.
jobStreamMap
.
set
(
trialJobDetail
.
id
,
stream
);
}
private
async
runHostJob
(
form
:
HostJobApplicationForm
):
Promise
<
TrialJobDetail
>
{
...
...
src/nni_manager/training_service/local/localTrainingServiceForGPU.ts
View file @
bd346816
...
...
@@ -78,6 +78,7 @@ class LocalTrainingServiceForGPU extends LocalTrainingService {
}
protected
onTrialJobStatusChanged
(
trialJob
:
LocalTrialJobDetailForGPU
,
oldStatus
:
TrialJobStatus
):
void
{
super
.
onTrialJobStatusChanged
(
trialJob
,
oldStatus
);
if
(
trialJob
.
gpuIndices
!==
undefined
&&
trialJob
.
gpuIndices
.
length
!==
0
&&
this
.
gpuScheduler
!==
undefined
)
{
if
(
oldStatus
===
'
RUNNING
'
&&
trialJob
.
status
!==
'
RUNNING
'
)
{
for
(
const
index
of
trialJob
.
gpuIndices
)
{
...
...
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