Commit d5e9a576 authored by suiguoxin's avatar suiguoxin
Browse files

add get_trial_id

parent 7c103cda
...@@ -96,3 +96,7 @@ def send_metric(string): ...@@ -96,3 +96,7 @@ def send_metric(string):
def get_sequence_id(): def get_sequence_id():
return trial_env_vars.NNI_TRIAL_SEQ_ID return trial_env_vars.NNI_TRIAL_SEQ_ID
def get_trial_id():
return trial_env_vars.NNI_TRIAL_JOB_ID
\ No newline at end of file
...@@ -28,6 +28,9 @@ def get_next_parameter(): ...@@ -28,6 +28,9 @@ def get_next_parameter():
def get_sequence_id(): def get_sequence_id():
pass pass
def get_trial_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':
......
...@@ -35,6 +35,9 @@ def get_next_parameter(): ...@@ -35,6 +35,9 @@ def get_next_parameter():
def get_sequence_id(): def get_sequence_id():
return 0 return 0
def get_trial_id():
return 0
def send_metric(string): def send_metric(string):
global _last_metric global _last_metric
_last_metric = string _last_metric = string
......
...@@ -30,12 +30,14 @@ __all__ = [ ...@@ -30,12 +30,14 @@ __all__ = [
'get_current_parameter', 'get_current_parameter',
'report_intermediate_result', 'report_intermediate_result',
'report_final_result', 'report_final_result',
'get_sequence_id' 'get_sequence_id',
'get_trial_id'
] ]
_params = None _params = None
_sequence_id = platform.get_sequence_id() _sequence_id = platform.get_sequence_id()
_trial_id = platform.get_trial_id()
def get_next_parameter(): def get_next_parameter():
...@@ -55,6 +57,9 @@ def get_current_parameter(tag): ...@@ -55,6 +57,9 @@ def get_current_parameter(tag):
def get_sequence_id(): def get_sequence_id():
return _sequence_id return _sequence_id
def get_trial_id():
return _trial_id
_intermediate_seq = 0 _intermediate_seq = 0
def report_intermediate_result(metric): def report_intermediate_result(metric):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment