Fix/plugin workflow migration (#3404)
* fix(plugin-workflow): fix migration * fix(plugin-workflow): add job.nodeKey when saving
This commit is contained in:
parent
8d06b73c48
commit
a4b9544944
@ -91,6 +91,7 @@ export default class extends Instruction {
|
|||||||
status: JOB_STATUS.PENDING,
|
status: JOB_STATUS.PENDING,
|
||||||
result: null,
|
result: null,
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: prevJob?.id ?? null,
|
upstreamId: prevJob?.id ?? null,
|
||||||
});
|
});
|
||||||
job.node = node;
|
job.node = node;
|
||||||
|
@ -32,6 +32,7 @@ export default class extends Instruction {
|
|||||||
// save loop index
|
// save loop index
|
||||||
result: 0,
|
result: 0,
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: prevJob?.id ?? null,
|
upstreamId: prevJob?.id ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ export default class extends Instruction {
|
|||||||
status: JOB_STATUS.PENDING,
|
status: JOB_STATUS.PENDING,
|
||||||
result: mode ? [] : null,
|
result: mode ? [] : null,
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: prevJob?.id ?? null,
|
upstreamId: prevJob?.id ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@ export default class extends Instruction {
|
|||||||
status: JOB_STATUS.PENDING,
|
status: JOB_STATUS.PENDING,
|
||||||
result: Array(branches.length).fill(null),
|
result: Array(branches.length).fill(null),
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: prevJob?.id ?? null,
|
upstreamId: prevJob?.id ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ export default class extends Instruction {
|
|||||||
const job = await processor.saveJob({
|
const job = await processor.saveJob({
|
||||||
status: JOB_STATUS.PENDING,
|
status: JOB_STATUS.PENDING,
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: prevJob?.id ?? null,
|
upstreamId: prevJob?.id ?? null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ export default class Processor {
|
|||||||
if (!(job instanceof Model)) {
|
if (!(job instanceof Model)) {
|
||||||
job.upstreamId = prevJob instanceof Model ? prevJob.get('id') : null;
|
job.upstreamId = prevJob instanceof Model ? prevJob.get('id') : null;
|
||||||
job.nodeId = node.id;
|
job.nodeId = node.id;
|
||||||
|
job.nodeKey = node.key;
|
||||||
}
|
}
|
||||||
const savedJob = await this.saveJob(job);
|
const savedJob = await this.saveJob(job);
|
||||||
|
|
||||||
@ -222,8 +223,7 @@ export default class Processor {
|
|||||||
}
|
}
|
||||||
this.jobsMap.set(job.id, job);
|
this.jobsMap.set(job.id, job);
|
||||||
|
|
||||||
const node = this.nodesMap.get(job.nodeId);
|
this.jobsMapByNodeKey[job.nodeKey] = job.result;
|
||||||
this.jobsMapByNodeKey[node.key] = job.result;
|
|
||||||
|
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,7 @@ export class ConditionInstruction extends Instruction {
|
|||||||
result,
|
result,
|
||||||
// TODO(optimize): try unify the building of job
|
// TODO(optimize): try unify the building of job
|
||||||
nodeId: node.id,
|
nodeId: node.id,
|
||||||
|
nodeKey: node.key,
|
||||||
upstreamId: (prevJob && prevJob.id) || null,
|
upstreamId: (prevJob && prevJob.id) || null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ export default class extends Migration {
|
|||||||
}
|
}
|
||||||
return job.update(
|
return job.update(
|
||||||
{
|
{
|
||||||
nodeKey: job.node.key,
|
nodeKey: job.node?.key,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
silent: true,
|
silent: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user