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

Handle exception and kill restserver in nnictl #2086

Merged
merged 37 commits into from
Feb 27, 2020

Conversation

SparkSnail
Copy link
Contributor

No description provided.

SparkSnail and others added 30 commits August 6, 2019 18:58
Filter prune algo implementation (microsoft#1655)
Support monitor mode when creating or resuming a new experiment (microsoft#1933)
Add test for documentation build (microsoft#1924)
restServerPid = nni_config.get_config('restServerPid')
if restServerPid:
kill_command(restServerPid)
print_error(exception)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to also add exit here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is a top level function, no more code will be executed after this function. If there is error here, it will exit the process automatically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is an exception, the exit code should be non-zero.
if you catch here, even there is an exception, exit code is still 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, fixed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about raising the error here instead of print_error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output format of raising error is not elegant, NNICTL use uniform print_error() method for error information.

if restServerPid:
kill_command(restServerPid)
print_error(exception)
exit(1)
new_nni_config.set_config('restServerPort', args.port)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious about this line. if users use --foreground, this line would not be executed, thus, new rest port would not be set, is this a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, moved new_nni_config.set_config('restServerPort', args.port) before launch_experiment() function.

@scarlett2018 scarlett2018 added this to the 2020 Feb - 1.4.1 release milestone Feb 24, 2020
@SparkSnail SparkSnail merged commit ba5d18c into microsoft:master Feb 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants