@tableau/taco-toolkit
Version:
Tableau Connector Toolkit
52 lines (51 loc) • 2.18 kB
TypeScript
/// <reference types="node" />
import { ChildProcess, ForkOptions } from 'child_process';
import { TempDataManager } from '../../modules/temp-data-manager';
import { EPSProcessName } from '../../types/eps-process-types';
export declare enum ProcessType {
/**
* The parent process of eps. The process manager monitors the process.
* If a parent process is killed, the process manager will terminate all
* eps related processes.
*/
parent = "parent",
/**
* The sibling process of the main eps process. If a sibling process is killed,
* the process manager will terminate all sibling and child processes.
*/
sibling = "sibling",
/**
* The independent child process of eps. e.g. extractor-app. If a child process is
* killed, the process manager will removes it from the watching list. A child process
* will never affect other eps processes.
*/
child = "child"
}
type EPSProcessInfo = {
type: ProcessType;
name: string;
pid: number;
process?: object;
};
export declare class EPSProcessManager {
private processes;
private tempDataManager;
constructor(tempDataManager: TempDataManager);
start(): void;
fork(epsProcessName: EPSProcessName, type: ProcessType.sibling | ProcessType.child, modulePath: string, args: string[], forkOptions?: ForkOptions): ChildProcess;
setupMainProcess(): void;
private checkProcesses;
addPID(pid: number, name: string, type: ProcessType): EPSProcessInfo[];
stopChildProcess(pid: number): void;
private stopAllProcesses;
/**
* processExists provides a mechanism to check whether a pid is an active process.
* Advantage of this is that it does not require a separate executable to work.
* The 3PL `processExists` has a dependency on fastlist, which on windows requires
* fastlist.exe. Bundling the fastlist executable with the EPS executable is not
* simple on Windows, so replacing 3PL solution with this fn avoids that dependency.
*/
processExists(pid: number): boolean;
}
export declare function getSortedProcessesToStop(processInfos: EPSProcessInfo[]): EPSProcessInfo[];
export {};