forked from siddharthvp/SDZeroBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toolforge-jobs.ts
25 lines (23 loc) · 959 Bytes
/
toolforge-jobs.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import {exec} from "child_process";
import {mapPath} from "./utils";
import {log} from "./botbase";
const pythonInterpreterPath = '~/www/python/venv/bin/python';
const toolforgeJobsScriptPath = '~/toolforge-jobs.py';
const toolforgeJobsCfgPath = '~/toolforge-jobs-framework-cli.cfg';
/**
* This relies on the fact that python is available in node16 container.
* The python venv is already setup. We run the toolforge-jobs.py script
* which is a copy of /usr/bin/toolforge-jobs copied to tool's home directory as /usr/bin is
* not mounted on the container.
*/
export function toolforgeJobs(...args: string[]) {
exec(mapPath(`${pythonInterpreterPath} ${toolforgeJobsScriptPath} --cfg ${toolforgeJobsCfgPath} ${args.join(' ')}`), function (err, stdout, stderr) {
if (stdout) {
console.log(stdout);
}
if (stderr) {
log(`[E] Error in toolforge-jobs`);
console.log(stderr);
}
});
}