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

Check eth0 in nnictl (#2566)

parent 0101f887
...@@ -58,6 +58,7 @@ setuptools.setup( ...@@ -58,6 +58,7 @@ setuptools.setup(
'PythonWebHDFS', 'PythonWebHDFS',
'hyperopt==0.1.2', 'hyperopt==0.1.2',
'json_tricks', 'json_tricks',
'netifaces',
'numpy', 'numpy',
'scipy', 'scipy',
'coverage', 'coverage',
......
...@@ -32,6 +32,7 @@ setup( ...@@ -32,6 +32,7 @@ setup(
'astor', 'astor',
'hyperopt==0.1.2', 'hyperopt==0.1.2',
'json_tricks', 'json_tricks',
'netifaces',
'numpy', 'numpy',
'psutil', 'psutil',
'ruamel.yaml', 'ruamel.yaml',
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import os import os
import json import json
import netifaces
from schema import SchemaError from schema import SchemaError
from schema import Schema from schema import Schema
from .config_schema import LOCAL_CONFIG_SCHEMA, REMOTE_CONFIG_SCHEMA, PAI_CONFIG_SCHEMA, PAI_YARN_CONFIG_SCHEMA, \ from .config_schema import LOCAL_CONFIG_SCHEMA, REMOTE_CONFIG_SCHEMA, PAI_CONFIG_SCHEMA, PAI_YARN_CONFIG_SCHEMA, \
...@@ -297,10 +298,19 @@ def validate_pai_trial_conifg(experiment_config): ...@@ -297,10 +298,19 @@ def validate_pai_trial_conifg(experiment_config):
print_warning(warning_information.format('outputDir')) print_warning(warning_information.format('outputDir'))
validate_pai_config_path(experiment_config) validate_pai_config_path(experiment_config)
def validate_eth0_device(experiment_config):
'''validate whether the machine has eth0 device'''
if experiment_config.get('trainingServicePlatform') not in ['local'] \
and not experiment_config.get('nniManagerIp') \
and 'eth0' not in netifaces.interfaces():
print_error('This machine does not contain eth0 network device, please set nniManagerIp in config file!')
exit(1)
def validate_all_content(experiment_config, config_path): def validate_all_content(experiment_config, config_path):
'''Validate whether experiment_config is valid''' '''Validate whether experiment_config is valid'''
parse_path(experiment_config, config_path) parse_path(experiment_config, config_path)
validate_common_content(experiment_config) validate_common_content(experiment_config)
validate_eth0_device(experiment_config)
validate_pai_trial_conifg(experiment_config) validate_pai_trial_conifg(experiment_config)
experiment_config['maxExecDuration'] = parse_time(experiment_config['maxExecDuration']) experiment_config['maxExecDuration'] = parse_time(experiment_config['maxExecDuration'])
if experiment_config.get('advisor'): if experiment_config.get('advisor'):
......
...@@ -16,7 +16,8 @@ setuptools.setup( ...@@ -16,7 +16,8 @@ setuptools.setup(
'astor', 'astor',
'schema', 'schema',
'PythonWebHDFS', 'PythonWebHDFS',
'colorama' 'colorama',
'netifaces'
], ],
author = 'Microsoft NNI Team', author = 'Microsoft NNI Team',
......
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