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
a4d62e95
Commit
a4d62e95
authored
Jul 23, 2019
by
suiguoxin
Browse files
add get_experiment_id
parent
d5e9a576
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
9 deletions
+23
-9
src/nni_manager/training_service/local/localTrainingService.ts
...ni_manager/training_service/local/localTrainingService.ts
+4
-1
src/sdk/pynni/nni/env_vars.py
src/sdk/pynni/nni/env_vars.py
+1
-0
src/sdk/pynni/nni/platform/local.py
src/sdk/pynni/nni/platform/local.py
+5
-3
src/sdk/pynni/nni/platform/standalone.py
src/sdk/pynni/nni/platform/standalone.py
+4
-1
src/sdk/pynni/nni/trial.py
src/sdk/pynni/nni/trial.py
+9
-4
No files found.
src/nni_manager/training_service/local/localTrainingService.ts
View file @
a4d62e95
...
@@ -26,7 +26,7 @@ import * as path from 'path';
...
@@ -26,7 +26,7 @@ import * as path from 'path';
import
*
as
ts
from
'
tail-stream
'
;
import
*
as
ts
from
'
tail-stream
'
;
import
*
as
tkill
from
'
tree-kill
'
;
import
*
as
tkill
from
'
tree-kill
'
;
import
{
NNIError
,
NNIErrorNames
}
from
'
../../common/errors
'
;
import
{
NNIError
,
NNIErrorNames
}
from
'
../../common/errors
'
;
import
{
getInitTrialSequenceId
}
from
'
../../common/experimentStartupInfo
'
;
import
{
getExperimentId
,
getInitTrialSequenceId
}
from
'
../../common/experimentStartupInfo
'
;
import
{
getLogger
,
Logger
}
from
'
../../common/log
'
;
import
{
getLogger
,
Logger
}
from
'
../../common/log
'
;
import
{
import
{
HostJobApplicationForm
,
HyperParameters
,
JobApplicationForm
,
TrainingService
,
TrialJobApplicationForm
,
HostJobApplicationForm
,
HyperParameters
,
JobApplicationForm
,
TrainingService
,
TrialJobApplicationForm
,
...
@@ -126,6 +126,7 @@ class LocalTrainingService implements TrainingService {
...
@@ -126,6 +126,7 @@ class LocalTrainingService implements TrainingService {
private
stopping
:
boolean
;
private
stopping
:
boolean
;
private
rootDir
!
:
string
;
private
rootDir
!
:
string
;
private
trialSequenceId
:
number
;
private
trialSequenceId
:
number
;
private
readonly
experimentId
!
:
string
;
private
gpuScheduler
!
:
GPUScheduler
;
private
gpuScheduler
!
:
GPUScheduler
;
private
readonly
occupiedGpuIndexNumMap
:
Map
<
number
,
number
>
;
private
readonly
occupiedGpuIndexNumMap
:
Map
<
number
,
number
>
;
private
designatedGpuIndices
!
:
Set
<
number
>
;
private
designatedGpuIndices
!
:
Set
<
number
>
;
...
@@ -145,6 +146,7 @@ class LocalTrainingService implements TrainingService {
...
@@ -145,6 +146,7 @@ class LocalTrainingService implements TrainingService {
this
.
stopping
=
false
;
this
.
stopping
=
false
;
this
.
log
=
getLogger
();
this
.
log
=
getLogger
();
this
.
trialSequenceId
=
-
1
;
this
.
trialSequenceId
=
-
1
;
this
.
experimentId
=
getExperimentId
();
this
.
jobStreamMap
=
new
Map
<
string
,
ts
.
Stream
>
();
this
.
jobStreamMap
=
new
Map
<
string
,
ts
.
Stream
>
();
this
.
log
.
info
(
'
Construct local machine training service.
'
);
this
.
log
.
info
(
'
Construct local machine training service.
'
);
this
.
occupiedGpuIndexNumMap
=
new
Map
<
number
,
number
>
();
this
.
occupiedGpuIndexNumMap
=
new
Map
<
number
,
number
>
();
...
@@ -400,6 +402,7 @@ class LocalTrainingService implements TrainingService {
...
@@ -400,6 +402,7 @@ class LocalTrainingService implements TrainingService {
resource
:
{
gpuIndices
:
number
[]
}):
{
key
:
string
;
value
:
string
}[]
{
resource
:
{
gpuIndices
:
number
[]
}):
{
key
:
string
;
value
:
string
}[]
{
const
envVariables
:
{
key
:
string
;
value
:
string
}[]
=
[
const
envVariables
:
{
key
:
string
;
value
:
string
}[]
=
[
{
key
:
'
NNI_PLATFORM
'
,
value
:
'
local
'
},
{
key
:
'
NNI_PLATFORM
'
,
value
:
'
local
'
},
{
key
:
'
NNI_EXP_ID
'
,
value
:
this
.
experimentId
},
{
key
:
'
NNI_SYS_DIR
'
,
value
:
trialJobDetail
.
workingDirectory
},
{
key
:
'
NNI_SYS_DIR
'
,
value
:
trialJobDetail
.
workingDirectory
},
{
key
:
'
NNI_TRIAL_JOB_ID
'
,
value
:
trialJobDetail
.
id
},
{
key
:
'
NNI_TRIAL_JOB_ID
'
,
value
:
trialJobDetail
.
id
},
{
key
:
'
NNI_OUTPUT_DIR
'
,
value
:
trialJobDetail
.
workingDirectory
},
{
key
:
'
NNI_OUTPUT_DIR
'
,
value
:
trialJobDetail
.
workingDirectory
},
...
...
src/sdk/pynni/nni/env_vars.py
View file @
a4d62e95
...
@@ -24,6 +24,7 @@ from collections import namedtuple
...
@@ -24,6 +24,7 @@ from collections import namedtuple
_trial_env_var_names
=
[
_trial_env_var_names
=
[
'NNI_PLATFORM'
,
'NNI_PLATFORM'
,
'NNI_EXP_ID'
,
'NNI_TRIAL_JOB_ID'
,
'NNI_TRIAL_JOB_ID'
,
'NNI_SYS_DIR'
,
'NNI_SYS_DIR'
,
'NNI_OUTPUT_DIR'
,
'NNI_OUTPUT_DIR'
,
...
...
src/sdk/pynni/nni/platform/local.py
View file @
a4d62e95
...
@@ -94,9 +94,11 @@ def send_metric(string):
...
@@ -94,9 +94,11 @@ def send_metric(string):
else
:
else
:
subprocess
.
run
([
'touch'
,
_metric_file
.
name
],
check
=
True
)
subprocess
.
run
([
'touch'
,
_metric_file
.
name
],
check
=
True
)
def
get_
sequence
_id
():
def
get_
experiment
_id
():
return
trial_env_vars
.
NNI_
TRIAL_SEQ
_ID
return
trial_env_vars
.
NNI_
EXP
_ID
def
get_trial_id
():
def
get_trial_id
():
return
trial_env_vars
.
NNI_TRIAL_JOB_ID
return
trial_env_vars
.
NNI_TRIAL_JOB_ID
\ No newline at end of file
def
get_sequence_id
():
return
trial_env_vars
.
NNI_TRIAL_SEQ_ID
src/sdk/pynni/nni/platform/standalone.py
View file @
a4d62e95
...
@@ -25,12 +25,15 @@ import json_tricks
...
@@ -25,12 +25,15 @@ import json_tricks
def
get_next_parameter
():
def
get_next_parameter
():
pass
pass
def
get_
sequence
_id
():
def
get_
experiment
_id
():
pass
pass
def
get_trial_id
():
def
get_trial_id
():
pass
pass
def
get_sequence_id
():
pass
def
send_metric
(
string
):
def
send_metric
(
string
):
metric
=
json_tricks
.
loads
(
string
)
metric
=
json_tricks
.
loads
(
string
)
if
metric
[
'type'
]
==
'FINAL'
:
if
metric
[
'type'
]
==
'FINAL'
:
...
...
src/sdk/pynni/nni/trial.py
View file @
a4d62e95
...
@@ -30,14 +30,16 @@ __all__ = [
...
@@ -30,14 +30,16 @@ __all__ = [
'get_current_parameter'
,
'get_current_parameter'
,
'report_intermediate_result'
,
'report_intermediate_result'
,
'report_final_result'
,
'report_final_result'
,
'get_experiment_id'
,
'get_trial_id'
,
'get_sequence_id'
,
'get_sequence_id'
,
'get_trial_id'
]
]
_params
=
None
_params
=
None
_
sequence
_id
=
platform
.
get_
sequence
_id
()
_
experiment
_id
=
platform
.
get_
experiment
_id
()
_trial_id
=
platform
.
get_trial_id
()
_trial_id
=
platform
.
get_trial_id
()
_sequence_id
=
platform
.
get_sequence_id
()
def
get_next_parameter
():
def
get_next_parameter
():
...
@@ -54,12 +56,15 @@ def get_current_parameter(tag):
...
@@ -54,12 +56,15 @@ def get_current_parameter(tag):
return
None
return
None
return
_params
[
'parameters'
][
tag
]
return
_params
[
'parameters'
][
tag
]
def
get_
sequence
_id
():
def
get_
experiment
_id
():
return
_
sequence
_id
return
_
experiment
_id
def
get_trial_id
():
def
get_trial_id
():
return
_trial_id
return
_trial_id
def
get_sequence_id
():
return
_sequence_id
_intermediate_seq
=
0
_intermediate_seq
=
0
def
report_intermediate_result
(
metric
):
def
report_intermediate_result
(
metric
):
...
...
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