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

Fix nni stop #368

Merged
merged 127 commits into from
Nov 16, 2018
Merged
Show file tree
Hide file tree
Changes from 126 commits
Commits
Show all changes
127 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
72f0e45
Merge pull request #48 from Microsoft/master
SparkSnail Oct 31, 2018
7c91af9
quick fix resume logic
Oct 31, 2018
26ef462
update
Oct 31, 2018
8237228
Merge pull request #49 from Microsoft/master
SparkSnail Oct 31, 2018
3404415
Merge pull request #52 from Microsoft/master
SparkSnail Nov 1, 2018
cbee322
fix nnictl in master
Nov 1, 2018
0d67eca
update
Nov 1, 2018
a982ed0
update
Nov 1, 2018
5d44f7b
update
Nov 1, 2018
88072dc
update
Nov 1, 2018
12a3e21
Merge pull request #53 from Microsoft/master
SparkSnail Nov 1, 2018
e4b2082
remove paramiko
Nov 2, 2018
53167b4
update
Nov 2, 2018
384a159
Merge pull request #57 from Microsoft/master
SparkSnail Nov 2, 2018
96ad3ed
refactor requirement.txt of sklearn
Nov 2, 2018
cb9d74e
Merge branch 'master' into master
SparkSnail Nov 2, 2018
8a026cc
update
Nov 2, 2018
369a303
Merge branch 'master' of https://github.com/SparkSnail/nni
Nov 2, 2018
7499de7
fix readme.md
Nov 2, 2018
78ee31c
update
Nov 2, 2018
e7245f8
update
Nov 2, 2018
775701a
update
Nov 2, 2018
1520a3e
fix conflict
Nov 5, 2018
0a3c103
Merge branch 'Microsoft-master'
Nov 5, 2018
4dbbb90
fix conflict
Nov 5, 2018
3eb8ea0
Merge branch 'Microsoft-master'
Nov 5, 2018
c34809d
add HowToContribute.md
Nov 5, 2018
cfca9f2
add port in experiment list
Nov 7, 2018
f31b27b
fix localTrainingService stop logic
Nov 7, 2018
84fe396
support pai port
Nov 7, 2018
b12ed90
update
Nov 7, 2018
0ebbb29
Merge pull request #61 from Microsoft/master
SparkSnail Nov 9, 2018
5123ab1
update
Nov 9, 2018
9771511
update
Nov 9, 2018
66cecf4
Merge pull request #62 from Microsoft/master
SparkSnail Nov 9, 2018
618860a
add sklearn version
Nov 9, 2018
bd4f431
add pytorch in dockerfile
Nov 12, 2018
24c7a8c
fix conflict
Nov 12, 2018
cac435e
fix conflict
Nov 12, 2018
c742f38
Merge branch 'Microsoft-master'
Nov 12, 2018
0a8e3ab
update
Nov 12, 2018
d4e41f8
update
Nov 12, 2018
1a6b7e6
fix conflict
Nov 12, 2018
9cbe353
Merge branch 'Microsoft-master'
Nov 12, 2018
88d33ea
Merge pull request #65 from Microsoft/master
SparkSnail Nov 12, 2018
36c6bc2
update
Nov 13, 2018
ac6beb5
Merge pull request #66 from Microsoft/master
SparkSnail Nov 13, 2018
9ffbe8d
fix Dockerfile
Nov 13, 2018
a39c8f3
fix conflict
Nov 13, 2018
c280ba5
Merge branch 'Microsoft-master'
Nov 13, 2018
898b469
Merge pull request #68 from Microsoft/master
SparkSnail Nov 14, 2018
050d485
Merge pull request #69 from Microsoft/master
SparkSnail Nov 14, 2018
2bcca69
fix nnictl stop
Nov 14, 2018
1fc4369
update
Nov 16, 2018
0f6b466
update
Nov 16, 2018
5106381
update
Nov 16, 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
4 changes: 3 additions & 1 deletion src/nni_manager/common/restServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Deferred } from 'ts-deferred';
import { getLogger, Logger } from './log';
import { getBasePort } from './experimentStartupInfo';


/**
* Abstraction class to create a RestServer
* The module who wants to use a RestServer could <b>extends</b> this abstract class
Expand Down Expand Up @@ -90,6 +91,7 @@ export abstract class RestServer {
} else {
this.startTask.promise.then(
() => { // Started
//server.close() will not be executed
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this comment mean?

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.server.close().on('close', () => {
this.log.info('Rest server stopped.');
this.stopTask.resolve();
Expand All @@ -103,7 +105,7 @@ export abstract class RestServer {
}
);
}

this.stopTask.resolve()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why should we call this.stopTask.resolve() twice?

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.server.stop() may not be executed. refer https://nodejs.org/docs/latest/api/net.html#net_server_close_callback

return this.stopTask.promise;
}

Expand Down
1 change: 0 additions & 1 deletion src/nni_manager/core/nnimanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ class NNIManager implements Manager {

public async stopExperiment(): Promise<void> {
this.status.status = 'STOPPING';
await this.experimentDoneCleanUp();
}

public async getMetricData(trialJobId?: string, metricType?: MetricType): Promise<MetricDataRecord[]> {
Expand Down
20 changes: 15 additions & 5 deletions src/nni_manager/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,20 @@ mkDirP(getLogDir()).then(async () => {
});

process.on('SIGTERM', async () => {
const ds: DataStore = component.get(DataStore);
await ds.close();
const restServer: NNIRestServer = component.get(NNIRestServer);
await restServer.stop();
const log: Logger = getLogger();
log.close();
let hasError: boolean = false;
try{
const nniManager: Manager = component.get(Manager);
await nniManager.stopExperiment();
const ds: DataStore = component.get(DataStore);
await ds.close();
const restServer: NNIRestServer = component.get(NNIRestServer);
await restServer.stop();
}catch(err){
hasError = true;
log.error(`${err.stack}`);
}finally{
await log.close();
process.exit(hasError?1:0);
}
})
13 changes: 0 additions & 13 deletions src/nni_manager/rest_server/restHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class NNIRestHandler {
this.getExperimentProfile(router);
this.updateExperimentProfile(router);
this.startExperiment(router);
this.stopExperiment(router);
this.getTrialJobStatistics(router);
this.setClusterMetaData(router);
this.listTrialJobs(router);
Expand Down Expand Up @@ -158,18 +157,6 @@ class NNIRestHandler {
});
}

private stopExperiment(router: Router): void {
router.delete('/experiment', async (req: Request, res: Response) => {
try {
await this.tb.cleanUp();
await this.nniManager.stopExperiment();
res.send();
} catch (err) {
this.handle_error(err, res);
}
});
}

private getTrialJobStatistics(router: Router): void {
router.get('/job-statistics', (req: Request, res: Response) => {
this.nniManager.getTrialJobStatistics().then((statistics: TrialJobStatistics[]) => {
Expand Down
15 changes: 1 addition & 14 deletions tools/nni_cmd/nnictl_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,6 @@ def stop_experiment(args):
print_normal('Experiment is not running...')
experiment_config.update_experiment(experiment_id, 'status', 'stopped')
return
running, _ = check_rest_server_quick(rest_port)
stop_rest_result = True
if running:
response = rest_delete(experiment_url(rest_port), 20)
if not response or not check_response(response):
if response:
print_error(response.text)
else:
print_error('No response from restful server!')
stop_rest_result = False
#sleep to wait rest handler done
time.sleep(3)
rest_pid = nni_config.get_config('restServerPid')
if rest_pid:
stop_rest_cmds = ['kill', str(rest_pid)]
Expand All @@ -204,8 +192,7 @@ def stop_experiment(args):
except Exception as exception:
print_error(exception)
nni_config.set_config('tensorboardPidList', [])
if stop_rest_result:
print_normal('Stop experiment success!')
print_normal('Stop experiment success!')
experiment_config.update_experiment(experiment_id, 'status', 'stopped')
time_now = time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
experiment_config.update_experiment(experiment_id, 'endTime', str(time_now))
Expand Down