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

Commit

Permalink
Fix EMFILE error in local training service (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
SparkSnail authored Jun 24, 2019
1 parent 26792df commit 1bd3637
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ class LocalTrainingService implements TrainingService {
this.log.info('Stopping local machine training service...');
this.stopping = true;
for (const stream of this.jobStreamMap.values()) {
stream.destroy();
stream.end(0)
stream.emit('end')
}
if (this.gpuScheduler !== undefined) {
await this.gpuScheduler.stop();
Expand All @@ -372,7 +373,9 @@ class LocalTrainingService implements TrainingService {
if (stream === undefined) {
throw new Error(`Could not find stream in trial ${trialJob.id}`);
}
stream.destroy();
//Refer https://github.com/Juul/tail-stream/issues/20
stream.end(0)
stream.emit('end')
this.jobStreamMap.delete(trialJob.id);
}
}
Expand Down Expand Up @@ -567,7 +570,6 @@ class LocalTrainingService implements TrainingService {
buffer = remain;
}
});

this.jobStreamMap.set(trialJobDetail.id, stream);
}

Expand Down
3 changes: 2 additions & 1 deletion src/nni_manager/types/tail-stream/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
declare module 'tail-stream' {
export interface Stream {
on(type: 'data', callback: (data: Buffer) => void): void;
destroy(): void;
end(data: number): void;
emit(data: string): void;
}
export function createReadStream(path: string): Stream;
}

0 comments on commit 1bd3637

Please sign in to comment.