Unverified Commit cb25d66e authored by SparkSnail's avatar SparkSnail Committed by GitHub
Browse files

Merge pull request #190 from microsoft/master

merge master
parents 9fb25ccc 7ee86e1d
......@@ -2,9 +2,14 @@ import time
import nni
if __name__ == '__main__':
hyper_params = nni.get_next_parameter()
nni.get_next_parameter()
for i in range(10):
if i % 2 == 0:
print('report intermediate result without end of line.', end='')
else:
print('report intermediate result.')
nni.report_intermediate_result(0.1*(i+1))
time.sleep(2)
print('test final metrics not at line start.', end='')
nni.report_final_result(1.0)
print('done')
......@@ -76,4 +76,5 @@ jobs:
--nni_docker_image $TEST_IMG --data_dir $(data_dir) --output_dir $(output_dir) --nni_manager_ip $(nni_manager_ip)
PATH=$HOME/.local/bin:$PATH python3 config_test.py --ts pai --exclude multi_phase_batch,multi_phase_grid
PATH=$HOME/.local/bin:$PATH python3 metrics_test.py
displayName: 'integration test'
......@@ -53,6 +53,7 @@ jobs:
--remote_port $(cat port) --remote_pwd $(docker_pwd) --nni_manager_ip $(nni_manager_ip)
cat training_service.yml
PATH=$HOME/.local/bin:$PATH python3 config_test.py --ts remote --exclude cifar10,multi_phase_batch,multi_phase_grid
PATH=$HOME/.local/bin:$PATH python3 metrics_test.py
displayName: 'integration test'
- task: SSH@0
inputs:
......
......@@ -34,12 +34,12 @@ DEFAULT_REST_PORT = 8080
REST_TIME_OUT = 20
EXPERIMENT_SUCCESS_INFO = Fore.GREEN + 'Successfully started experiment!\n' + Fore.RESET + \
'-----------------------------------------------------------------------\n' \
'------------------------------------------------------------------------------------\n' \
'The experiment id is %s\n'\
'The Web UI urls are: %s\n' \
'-----------------------------------------------------------------------\n\n' \
'------------------------------------------------------------------------------------\n\n' \
'You can use these commands to get more information about the experiment\n' \
'-----------------------------------------------------------------------\n' \
'------------------------------------------------------------------------------------\n' \
' commands description\n' \
'1. nnictl experiment show show the information of experiments\n' \
'2. nnictl trial ls list all of trial jobs\n' \
......@@ -49,7 +49,9 @@ EXPERIMENT_SUCCESS_INFO = Fore.GREEN + 'Successfully started experiment!\n' + Fo
'6. nnictl stop stop an experiment\n' \
'7. nnictl trial kill kill a trial job by id\n' \
'8. nnictl --help get help information about nnictl\n' \
'-----------------------------------------------------------------------\n' \
'------------------------------------------------------------------------------------\n' \
'Command reference document https://nni.readthedocs.io/en/latest/Tutorial/Nnictl.html\n' \
'------------------------------------------------------------------------------------\n'
LOG_HEADER = '-----------------------------------------------------------------------\n' \
' Experiment start time %s\n' \
......
......@@ -151,7 +151,7 @@ def parse_ids(args):
exit(1)
else:
result_list = running_experiment_list
elif args.all:
elif args.id == 'all':
result_list = running_experiment_list
elif args.id.endswith('*'):
for id in running_experiment_list:
......@@ -166,7 +166,7 @@ def parse_ids(args):
if len(result_list) > 1:
print_error(args.id + ' is ambiguous, please choose ' + ' '.join(result_list) )
return None
if not result_list and args.id:
if not result_list and args.id and args.id != 'all':
print_error('There are no experiments matched, please set correct experiment id...')
elif not result_list:
print_error('There is no experiment running...')
......
......@@ -134,7 +134,7 @@ class PipeLogReader(threading.Thread):
self._is_read_completed = False
self.process_exit = False
self.log_collection = log_collection
self.log_pattern = re.compile(r'^NNISDK_MEb\'.*\'$')
self.log_pattern = re.compile(r'NNISDK_MEb\'.*\'$')
def _populateQueue(stream, queue):
'''
......@@ -172,11 +172,14 @@ class PipeLogReader(threading.Thread):
for line in iter(self.pipeReader.readline, ''):
self.orig_stdout.write(line.rstrip() + '\n')
self.orig_stdout.flush()
if self.log_collection == 'none':
# If not match metrics, do not put the line into queue
if not self.log_pattern.match(line):
continue
self.queue.put(line)
search_result = self.log_pattern.search(line)
if search_result:
metrics = search_result.group(0)
self.queue.put(metrics+'\n')
else:
self.queue.put(line)
self.pipeReader.close()
......
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