Fixed executor
This commit is contained in:
parent
089f07360c
commit
88f74a4e26
6 changed files with 38 additions and 12 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue