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

Add package install error information (#1385)

parent 204b1eba
......@@ -360,9 +360,14 @@ def launch_experiment(args, experiment_config, mode, config_file_name, experimen
module_name = AdvisorModuleName.get(package_name)
if package_name and module_name:
try:
check_call([sys.executable, '-c', 'import %s'%(module_name)], stdout=PIPE, stderr=PIPE)
stdout_full_path, stderr_full_path = get_log_path(config_file_name)
with open(stdout_full_path, 'a+') as stdout_file, open(stderr_full_path, 'a+') as stderr_file:
check_call([sys.executable, '-c', 'import %s'%(module_name)], stdout=stdout_file, stderr=stderr_file)
except CalledProcessError as e:
print_error('%s should be installed through \'nnictl package install --name %s\''%(package_name, package_name))
print_error('some errors happen when import package %s.' %(package_name))
print_log_content(config_file_name)
if package_name in PACKAGE_REQUIREMENTS:
print_error('If %s is not installed, it should be installed through \'nnictl package install --name %s\''%(package_name, package_name))
exit(1)
log_dir = experiment_config['logDir'] if experiment_config.get('logDir') else None
log_level = experiment_config['logLevel'] if experiment_config.get('logLevel') else None
......
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