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
5cbe425f
Unverified
Commit
5cbe425f
authored
Jul 07, 2020
by
SparkSnail
Committed by
GitHub
Jul 07, 2020
Browse files
Fix aml message index (#2648)
parent
4a76b68c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
src/nni_manager/training_service/reusable/aml/amlConfig.ts
src/nni_manager/training_service/reusable/aml/amlConfig.ts
+1
-0
src/nni_manager/training_service/reusable/channels/amlCommandChannel.ts
...r/training_service/reusable/channels/amlCommandChannel.ts
+9
-7
No files found.
src/nni_manager/training_service/reusable/aml/amlConfig.ts
View file @
5cbe425f
...
...
@@ -36,4 +36,5 @@ export class AMLTrialConfig extends TrialConfig {
export
class
AMLEnvironmentInformation
extends
EnvironmentInformation
{
public
amlClient
?:
AMLClient
;
public
currentMessageIndex
:
number
=
-
1
;
}
src/nni_manager/training_service/reusable/channels/amlCommandChannel.ts
View file @
5cbe425f
...
...
@@ -14,7 +14,6 @@ class AMLRunnerConnection extends RunnerConnection {
export
class
AMLCommandChannel
extends
CommandChannel
{
private
stopping
:
boolean
=
false
;
private
currentMessageIndex
:
number
=
-
1
;
private
sendQueues
:
[
EnvironmentInformation
,
string
][]
=
[];
private
readonly
NNI_METRICS_PATTERN
:
string
=
`NNISDK_MEb'(?<metrics>.*?)'`
;
...
...
@@ -89,7 +88,9 @@ export class AMLCommandChannel extends CommandChannel {
const
runnerConnections
=
[...
this
.
runnerConnections
.
values
()]
as
AMLRunnerConnection
[];
for
(
const
runnerConnection
of
runnerConnections
)
{
// to loop all commands
const
amlClient
=
(
runnerConnection
.
environment
as
AMLEnvironmentInformation
).
amlClient
;
const
amlEnvironmentInformation
:
AMLEnvironmentInformation
=
runnerConnection
.
environment
as
AMLEnvironmentInformation
;
const
amlClient
=
amlEnvironmentInformation
.
amlClient
;
let
currentMessageIndex
=
amlEnvironmentInformation
.
currentMessageIndex
;
if
(
!
amlClient
)
{
throw
new
Error
(
'
AML client not initialized!
'
);
}
...
...
@@ -97,15 +98,16 @@ export class AMLCommandChannel extends CommandChannel {
if
(
command
&&
Object
.
prototype
.
hasOwnProperty
.
call
(
command
,
"
trial_runner
"
))
{
const
messages
=
command
[
'
trial_runner
'
];
if
(
messages
)
{
if
(
messages
instanceof
Object
&&
this
.
currentMessageIndex
<
messages
.
length
-
1
)
{
for
(
let
index
=
this
.
currentMessageIndex
+
1
;
index
<
messages
.
length
;
index
++
)
{
if
(
messages
instanceof
Object
&&
currentMessageIndex
<
messages
.
length
-
1
)
{
for
(
let
index
=
currentMessageIndex
+
1
;
index
<
messages
.
length
;
index
++
)
{
this
.
handleCommand
(
runnerConnection
.
environment
,
messages
[
index
]);
}
this
.
currentMessageIndex
=
messages
.
length
-
1
;
}
else
if
(
this
.
currentMessageIndex
===
-
1
){
currentMessageIndex
=
messages
.
length
-
1
;
}
else
if
(
currentMessageIndex
===
-
1
){
this
.
handleCommand
(
runnerConnection
.
environment
,
messages
);
this
.
currentMessageIndex
+=
1
;
currentMessageIndex
+=
1
;
}
amlEnvironmentInformation
.
currentMessageIndex
=
currentMessageIndex
;
}
}
}
...
...
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