Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add externalid to job #1885

Merged
merged 4 commits into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions core/api-server/api/graphql/schemas/job-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ type Batch {
}

type Job { key: String
externalId:String
results: Results
graph: Graph
status: Status
Expand Down
10 changes: 5 additions & 5 deletions core/api-server/lib/service/execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ExecutionService {

async runStored(options) {
validator.executions.validateRunStoredPipeline(options);
return this._runStored({ pipeline: options, parentSpan: options.spanId, types: [pipelineTypes.STORED] });
return this._runStored({ pipeline: options, parentSpan: options.spanId, externalId: options.externalId, types: [pipelineTypes.STORED] });
}

async runCaching(options) {
Expand Down Expand Up @@ -77,7 +77,7 @@ class ExecutionService {
}

async _runStored(options) {
const { pipeline, jobId, rootJobId, parentSpan, types, mergeFlowInput } = options;
const { pipeline, jobId, rootJobId, parentSpan, types, mergeFlowInput, externalId } = options;
const storedPipeline = await stateManager.getPipeline({ name: pipeline.name });
if (!storedPipeline) {
throw new ResourceNotFoundError('pipeline', pipeline.name);
Expand All @@ -89,11 +89,11 @@ class ExecutionService {
}
return undefined;
});
return this._runPipeline({ pipeline: newPipeline, jobId, rootJobId, parentSpan, types });
return this._runPipeline({ pipeline: newPipeline, jobId, rootJobId, parentSpan, types, externalId });
}

async _runPipeline(payload) {
const { pipeline, rootJobId, options, parentSpan, types } = payload;
const { pipeline, rootJobId, options, parentSpan, types, externalId } = payload;
const { flowInputMetadata, flowInput, ...restPipeline } = pipeline;
const { validateNodes } = options || {};
let extendedPipeline = restPipeline;
Expand Down Expand Up @@ -133,7 +133,7 @@ class ExecutionService {
const pipelineObject = { ...extendedPipeline, maxExceeded, rootJobId, flowInputMetadata: pipeFlowInputMetadata, startTime: Date.now(), lastRunResult, types: pipeTypes };
const statusObject = { timestamp: Date.now(), pipeline: extendedPipeline.name, status: pipelineStatuses.PENDING, level: levels.INFO.name };
await storageManager.hkubeIndex.put({ jobId }, tracer.startSpan.bind(tracer, { name: 'storage-put-index', parent: span.context() }));
await stateManager.createJob({ jobId, userPipeline, pipeline: pipelineObject, status: statusObject, completion: false });
await stateManager.createJob({ jobId, userPipeline, externalId, pipeline: pipelineObject, status: statusObject, completion: false });
await producer.createJob({ jobId, parentSpan: span.context() });
span.finish();
return { jobId, gateways: extendedPipeline.streaming?.gateways };
Expand Down
4 changes: 2 additions & 2 deletions core/api-server/lib/state/state-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ class StateManager extends EventEmitter {
});
}

async createJob({ jobId, userPipeline, pipeline, status, completion }) {
await this._db.jobs.create({ jobId, userPipeline, pipeline, status, completion });
async createJob({ jobId, externalId, userPipeline, pipeline, status, completion }) {
await this._db.jobs.create({ jobId, externalId, userPipeline, pipeline, status, completion });
await this._etcd.jobs.status.set({ jobId, ...status });
}

Expand Down
8 changes: 4 additions & 4 deletions core/api-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/api-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@hkube/config": "^2.0.11",
"@hkube/consts": "^1.0.48",
"@hkube/dag": "^2.1.25",
"@hkube/db": "^2.0.13",
"@hkube/db": "^2.0.15",
"@hkube/elastic-client": "^1.0.4",
"@hkube/etcd": "^5.1.10",
"@hkube/healthchecks": "^1.0.2",
Expand Down
Loading