Skip to content

Commit 6aa2cb3

Browse files
committed
make the toolforge-jobs module just a wrapper around the python script
1 parent 719d9d0 commit 6aa2cb3

File tree

4 files changed

+25
-64
lines changed

4 files changed

+25
-64
lines changed

jobs.ts

Lines changed: 0 additions & 62 deletions
This file was deleted.

package-lock.json

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"async-redis": "^1.1.7",
2323
"eventsource": "^1.0.7",
2424
"express": "^4.17.1",
25-
"js-yaml": "^4.1.0",
2625
"jsdom": "^16.2.1",
2726
"minimist": "^1.2.5",
2827
"moment": "^2.29.1",

toolforge-jobs.ts

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

0 commit comments

Comments
 (0)