Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Show error information and fix paramiko installation #282

Merged
merged 71 commits into from
Oct 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
dc780cd
Merge pull request #1 from Microsoft/master
SparkSnail Sep 14, 2018
86243e7
Merge pull request #2 from Microsoft/master
SparkSnail Sep 14, 2018
3d1e4e9
fix nnictl bug
Sep 14, 2018
6d09780
Merge pull request #4 from Microsoft/master
SparkSnail Sep 17, 2018
0d24158
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 18, 2018
6d669c6
Merge pull request #6 from Microsoft/master
SparkSnail Sep 19, 2018
af2615d
Merge pull request #8 from Microsoft/master
SparkSnail Sep 20, 2018
f6b7c0a
Merge pull request #9 from Microsoft/master
SparkSnail Sep 24, 2018
a74febc
Merge pull request #10 from Microsoft/master
SparkSnail Sep 25, 2018
334b0a4
Merge pull request #12 from Microsoft/master
SparkSnail Sep 27, 2018
efe93df
Merge pull request #13 from Microsoft/master
SparkSnail Sep 27, 2018
0d9b074
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 28, 2018
421ad1a
Merge pull request #16 from Microsoft/master
SparkSnail Sep 30, 2018
660a8f8
Merge branch 'master' of https://github.com/SparkSnail/nni
Sep 30, 2018
2b01089
fix install.sh
Sep 30, 2018
951e80e
Merge pull request #17 from Microsoft/master
SparkSnail Oct 1, 2018
90fe674
Merge pull request #18 from Microsoft/master
SparkSnail Oct 7, 2018
2ccf0ed
Merge pull request #19 from Microsoft/master
SparkSnail Oct 8, 2018
77aacee
Merge pull request #20 from Microsoft/master
SparkSnail Oct 8, 2018
9e23dfe
Merge pull request #22 from Microsoft/master
SparkSnail Oct 8, 2018
ca7bbe4
Merge pull request #24 from Microsoft/master
SparkSnail Oct 10, 2018
346badd
add desc for Dockerfile.build.base
Oct 10, 2018
4af27d6
Merge pull request #27 from Microsoft/master
SparkSnail Oct 11, 2018
46a8350
update document for Dockerfile
Oct 11, 2018
4e3697f
Merge pull request #29 from Microsoft/master
SparkSnail Oct 12, 2018
4cd95aa
Merge pull request #30 from Microsoft/master
SparkSnail Oct 15, 2018
405ce45
Merge pull request #31 from Microsoft/master
SparkSnail Oct 15, 2018
c3949e6
Merge pull request #32 from Microsoft/master
SparkSnail Oct 16, 2018
22c78fd
Merge pull request #33 from Microsoft/master
SparkSnail Oct 16, 2018
a870817
update
Oct 16, 2018
b45268c
refactor port detect
Oct 16, 2018
59626ec
update
Oct 16, 2018
31ea28b
Merge pull request #34 from Microsoft/master
SparkSnail Oct 16, 2018
2ca84c5
refactor NNICTLDOC.md
Oct 17, 2018
ab02c93
add document for pai and nnictl
Oct 17, 2018
5ff7b45
add default value for port
Oct 17, 2018
c1e835d
Merge pull request #35 from Microsoft/master
SparkSnail Oct 18, 2018
5ae146d
add exception handling in trial_keeper.py
Oct 18, 2018
1dde461
fix port bug
Oct 18, 2018
fe6a188
Merge pull request #36 from Microsoft/master
SparkSnail Oct 18, 2018
f7a5228
Merge pull request #37 from Microsoft/master
SparkSnail Oct 19, 2018
9fdf6d4
fix resume
Oct 19, 2018
c1285f8
fix nnictl resume and fix nnictl stop
Oct 19, 2018
af0d081
fix document
Oct 19, 2018
7ce8fd8
update
Oct 19, 2018
b29aaed
refactor nnictl
Oct 19, 2018
683833b
update
Oct 19, 2018
6149bf9
update doc
Oct 22, 2018
73bef2f
update
Oct 22, 2018
5c397f6
update nnictl
Oct 23, 2018
2c68171
fix comment
Oct 23, 2018
d0659d6
fix conflict
Oct 23, 2018
e64abbf
Merge branch 'Microsoft-master'
Oct 23, 2018
a70f7e7
Merge pull request #39 from Microsoft/master
SparkSnail Oct 23, 2018
8d14ca9
revert dockerfile
Oct 23, 2018
aeb7c66
update
Oct 23, 2018
a256549
update
Oct 23, 2018
3fb0bca
update
Oct 23, 2018
e116af4
Merge pull request #40 from Microsoft/master
SparkSnail Oct 23, 2018
f4edebc
Merge pull request #41 from Microsoft/master
SparkSnail Oct 24, 2018
9413d77
Merge pull request #42 from Microsoft/master
SparkSnail Oct 25, 2018
c0663e8
Merge pull request #43 from Microsoft/master
SparkSnail Oct 25, 2018
357545b
Merge pull request #44 from Microsoft/master
SparkSnail Oct 26, 2018
e8dec33
Merge pull request #45 from Microsoft/master
SparkSnail Oct 27, 2018
46bf7b4
fix nnictl error hit
Oct 30, 2018
7fd0ac3
Merge pull request #46 from Microsoft/master
SparkSnail Oct 30, 2018
4cc7d92
Merge branch 'master' of https://github.com/SparkSnail/nni
Oct 30, 2018
55701a2
fix comments
Oct 30, 2018
25d1c22
Merge pull request #47 from Microsoft/master
SparkSnail Oct 30, 2018
b6b45d1
fix bash-completion
Oct 30, 2018
04c03a4
fix paramiko install
Oct 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def run(self):
'requests',
'scipy',
'schema',
'pyhdfs',
'paramiko'
'pyhdfs'
],

cmdclass={
Expand Down
18 changes: 9 additions & 9 deletions tools/bash-completion
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# list of commands/arguments
__nnictl_cmds="create resume update stop trial experiment config rest log"
__nnictl_create_cmds="--config --webuiport"
__nnictl_resume_cmds="--experiment --manager --webuiport"
__nnictl_update_cmds="searchspace concurrency duration"
__nnictl_cmds="create resume update stop trial experiment config webui log"
__nnictl_create_cmds="--config --port"
__nnictl_resume_cmds="--port"
__nnictl_update_cmds="searchspace concurrency duration trialnum"
__nnictl_update_searchspace_cmds="--filename"
__nnictl_update_concurrency_cmds="--value"
__nnictl_update_duration_cmds="--value"
__nnictl_update_trialnum_cmds="--value"
__nnictl_trial_cmds="ls kill"
__nnictl_trial_kill_cmds="--trialid"
__nnictl_webui_cmds="start stop url"
__nnictl_webui_start_cmds="--port"
__nnictl_experiment_cmds="show"
__nnictl_webui_cmds="url"
__nnictl_experiment_cmds="show list status"
__nnictl_experiment_list_cmds="all"
__nnictl_config_cmds="show"
__nnictl_rest_cmds="check"
__nnictl_log_cmds="stdout stderr"
__nnictl_log_cmds="stdout stderr trial"
__nnictl_log_stdout_cmds="--tail --head --path"
__nnictl_log_stderr_cmds="--tail --head --path"

Expand Down
39 changes: 30 additions & 9 deletions tools/nnicmd/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import os
import shutil
import string
from subprocess import Popen, PIPE, call
from subprocess import Popen, PIPE, call, check_output
import tempfile
from nni_annotation import *
from .launcher_utils import validate_all_content
Expand All @@ -36,6 +36,26 @@
import random
import string

def get_log_path(config_file_name):
'''generate stdout and stderr log path'''
stdout_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stdout')
SparkSnail marked this conversation as resolved.
Show resolved Hide resolved
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
return stdout_full_path, stderr_full_path

def print_log_content(config_file_name):
'''print log information'''
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
print_normal(' Stdout:')
stdout_cmds = ['cat', stdout_full_path]
stdout_content = check_output(stdout_cmds)
print(stdout_content.decode('utf-8'))
SparkSnail marked this conversation as resolved.
Show resolved Hide resolved
print('\n\n')
print_normal(' Stderr:')
stderr_cmds = ['cat', stderr_full_path]
stderr_content = check_output(stderr_cmds)
print(stderr_content.decode('utf-8'))


def start_rest_server(port, platform, mode, config_file_name, experiment_id=None):
'''Run nni manager process'''
nni_config = Config(config_file_name)
Expand All @@ -48,8 +68,7 @@ def start_rest_server(port, platform, mode, config_file_name, experiment_id=None
cmds = [manager, '--port', str(port), '--mode', platform, '--start_mode', mode]
if mode == 'resume':
cmds += ['--experiment_id', experiment_id]
stdout_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stdout')
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
stdout_file = open(stdout_full_path, 'a+')
stderr_file = open(stderr_full_path, 'a+')
time_now = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
Expand Down Expand Up @@ -83,7 +102,7 @@ def set_trial_config(experiment_config, port, config_file_name):
return True
else:
print('Error message is {}'.format(response.text))
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
_, stderr_full_path = get_log_path(config_file_name)
with open(stderr_full_path, 'a+') as fout:
fout.write(json.dumps(json.loads(response.text), indent=4, sort_keys=True, separators=(',', ':')))
return False
Expand All @@ -102,7 +121,7 @@ def set_remote_config(experiment_config, port, config_file_name):
if not response or not check_response(response):
if response is not None:
err_message = response.text
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
_, stderr_full_path = get_log_path(config_file_name)
with open(stderr_full_path, 'a+') as fout:
fout.write(json.dumps(json.loads(err_message), indent=4, sort_keys=True, separators=(',', ':')))
return False, err_message
Expand All @@ -119,7 +138,7 @@ def set_pai_config(experiment_config, port, config_file_name):
if not response or not response.status_code == 200:
if response is not None:
err_message = response.text
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
_, stderr_full_path = get_log_path(config_file_name)
with open(stderr_full_path, 'a+') as fout:
fout.write(json.dumps(json.loads(err_message), indent=4, sort_keys=True, separators=(',', ':')))
return False, err_message
Expand Down Expand Up @@ -185,7 +204,7 @@ def set_experiment(experiment_config, mode, port, config_file_name):
if check_response(response):
return response
else:
stderr_full_path = os.path.join(NNICTL_HOME_DIR, config_file_name, 'stderr')
_, stderr_full_path = get_log_path(config_file_name)
with open(stderr_full_path, 'a+') as fout:
fout.write(json.dumps(json.loads(response.text), indent=4, sort_keys=True, separators=(',', ':')))
print_error('Setting experiment error, error message is {}'.format(response.text))
Expand Down Expand Up @@ -220,6 +239,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
print_normal('Successfully started Restful server!')
else:
print_error('Restful server start failed!')
print_log_content(config_file_name)
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
call(cmds)
Expand Down Expand Up @@ -248,7 +268,7 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
if set_local_config(experiment_config, args.port, config_file_name):
print_normal('Successfully set local config!')
else:
print_error('Failed!')
print_error('Set local config failed!')
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
call(cmds)
Expand Down Expand Up @@ -280,7 +300,8 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
experiment_id = json.loads(response.text).get('experiment_id')
nni_config.set_config('experimentId', experiment_id)
else:
print_error('Failed!')
print_error('Start experiment failed!')
print_log_content(config_file_name)
try:
cmds = ['pkill', '-P', str(rest_process.pid)]
call(cmds)
Expand Down
12 changes: 11 additions & 1 deletion tools/nnicmd/ssh_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

import paramiko
import os
from .common_utils import print_error
from subprocess import call

def check_environment():
'''check if paramiko is installed'''
try:
import paramiko
except:
cmds = 'python3 -m pip install --user paramiko'
call(cmds, shell=True)

def copy_remote_directory_to_local(sftp, remote_path, local_path):
'''copy remote directory to local machine'''
Expand All @@ -41,6 +49,8 @@ def copy_remote_directory_to_local(sftp, remote_path, local_path):
def create_ssh_sftp_client(host_ip, port, username, password):
'''create ssh client'''
try:
check_environment()
import paramiko
conn = paramiko.Transport(host_ip, port)
conn.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(conn)
Expand Down
3 changes: 1 addition & 2 deletions tools/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
'psutil',
'astor',
'schema',
'pyhdfs',
'paramiko'
'pyhdfs'
],

author = 'Microsoft NNI Team',
Expand Down