Fixed executor
This commit is contained in:
parent
089f07360c
commit
88f74a4e26
6 changed files with 38 additions and 12 deletions
BIN
bin/executor
BIN
bin/executor
Binary file not shown.
2
dist/bundles/qualiteer-executor.mjs
vendored
2
dist/bundles/qualiteer-executor.mjs
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
export default {
|
||||
command: (args)=>{},
|
||||
url: process.env.QUALITEER_URL,
|
||||
jobId: (args)=>{},
|
||||
command: (args)=>args.slice(2),
|
||||
url: (args) => args[0],
|
||||
jobId: (args)=>args[1],
|
||||
auth: (args)=>{},
|
||||
}
|
|
@ -12,9 +12,12 @@ const ERR = "e";
|
|||
const OUT = "o";
|
||||
|
||||
export default class Executor {
|
||||
constructor(url, job, options = {}) {
|
||||
this.url = url;
|
||||
this.job = job;
|
||||
constructor(args, config, options = {}) {
|
||||
this.url = config.url(args) ?? process.env.QUALITEER_URL;
|
||||
this.jobId =
|
||||
config.jobId(args) ?? process.env.QUALITEER_JOB_ID;
|
||||
this.command =
|
||||
config.command(args) ?? process.env.QUALITEER_COMMAND;
|
||||
this.mode = modes.EXEC;
|
||||
|
||||
// Internal Buffer
|
||||
|
@ -30,7 +33,7 @@ export default class Executor {
|
|||
}
|
||||
|
||||
spawn() {
|
||||
const cmdArgs = this.job.command;
|
||||
const cmdArgs = this.command;
|
||||
const cmd = cmdArgs.shift();
|
||||
this.proc = cp.spawn(cmd, cmdArgs);
|
||||
|
||||
|
@ -46,7 +49,7 @@ export default class Executor {
|
|||
|
||||
runJob() {
|
||||
const mgr = new Manager(this.url, {
|
||||
query: { mode: this.mode, jobId: this.job.id },
|
||||
query: { mode: this.mode, jobId: this.jobId },
|
||||
});
|
||||
this.socket = mgr.socket("/");
|
||||
this.socket.on("connect", this.spawn);
|
||||
|
|
25
package-lock.json
generated
25
package-lock.json
generated
|
@ -18,7 +18,6 @@
|
|||
"path": "^0.12.7",
|
||||
"pg-promise": "^10.11.1",
|
||||
"postgres-migrations": "^5.3.0",
|
||||
"rabbiteer": "gitlab:Dunemask/rabbiteer",
|
||||
"react-router-dom": "^6.3.0",
|
||||
"socket.io": "^4.4.1",
|
||||
"socket.io-client": "^4.4.1",
|
||||
|
@ -39,6 +38,7 @@
|
|||
"axios": "^0.27.2",
|
||||
"caxa": "^2.1.0",
|
||||
"nodemon": "^2.0.15",
|
||||
"prettier": "^2.7.1",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"readline-sync": "^1.4.10",
|
||||
|
@ -4427,6 +4427,21 @@
|
|||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"prettier": "bin-prettier.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
|
@ -9098,6 +9113,12 @@
|
|||
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=",
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.7.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz",
|
||||
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
|
||||
"dev": true
|
||||
},
|
||||
"process": {
|
||||
"version": "0.11.10",
|
||||
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
|
||||
|
@ -9189,7 +9210,7 @@
|
|||
},
|
||||
"rabbiteer": {
|
||||
"version": "git+ssh://git@gitlab.com/Dunemask/rabbiteer.git#7e341191029758fcae0a5e3e7ba3e4c217bd3788",
|
||||
"from": "rabbiteer@git+https://gitlab.com/Dunemask/rabbiteer.git",
|
||||
"from": "rabbiteer@gitlab:Dunemask/rabbiteer",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"amqplib": "^0.8.0"
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
"start:react:replit": "vite --host",
|
||||
"test": "node tests/index.js",
|
||||
"test:api": "node tests/api.js",
|
||||
"test:dev": "nodemon tests/index.js"
|
||||
"test:dev": "nodemon tests/index.js",
|
||||
"lint": "prettier -w lib/ src/"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
@ -65,6 +66,7 @@
|
|||
"axios": "^0.27.2",
|
||||
"caxa": "^2.1.0",
|
||||
"nodemon": "^2.0.15",
|
||||
"prettier": "^2.7.1",
|
||||
"react": "^18.1.0",
|
||||
"react-dom": "^18.1.0",
|
||||
"readline-sync": "^1.4.10",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue