notebook background execution (#8079)

* notebook background execution

* code review comments

* comments 2

* more logging
This commit is contained in:
Alan Ren
2019-10-29 11:53:50 -07:00
committed by GitHub
parent 6e7311ca87
commit 5629356c66
7 changed files with 83 additions and 20 deletions

View File

@@ -17,16 +17,21 @@ export function getDateTimeString(): string {
}
export function setEnvironmentVariablesForInstallPaths(tools: ITool[]): void {
// Use Set class to make sure the collection only contains unique values.
let installationPaths: Set<string> = new Set<string>();
tools.forEach(t => {
// construct an env variable name with NoteBookEnvironmentVariablePrefix prefix
// and tool.name as suffix, making sure of using all uppercase characters and only _ as separator
const envVarName: string = `${NoteBookEnvironmentVariablePrefix}${t.name.toUpperCase().replace(/ |-/, '_')}`;
process.env[envVarName] = t.installationPath;
installationPaths.add(path.resolve(path.dirname(t.installationPath)));
console.log(`setting env var:'${envVarName}' to: '${t.installationPath}'`);
if (t.installationPath) {
// construct an env variable name with NoteBookEnvironmentVariablePrefix prefix
// and tool.name as suffix, making sure of using all uppercase characters and only _ as separator
const envVarName: string = `${NoteBookEnvironmentVariablePrefix}${t.name.toUpperCase().replace(/ |-/g, '_')}`;
process.env[envVarName] = t.installationPath;
installationPaths.add(path.resolve(path.dirname(t.installationPath)));
console.log(`setting env var:'${envVarName}' to: '${t.installationPath}'`);
}
});
const envVarToolsInstallationPath: string = [...installationPaths.values()].join(path.delimiter);
process.env[ToolsInstallPath] = envVarToolsInstallationPath;
console.log(`setting env var:'${ToolsInstallPath}' to: '${envVarToolsInstallationPath}'`);
if (installationPaths.size > 0) {
const envVarToolsInstallationPath: string = [...installationPaths.values()].join(path.delimiter);
process.env[ToolsInstallPath] = envVarToolsInstallationPath;
console.log(`setting env var:'${ToolsInstallPath}' to: '${envVarToolsInstallationPath}'`);
}
}