Skip to content
Open
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
93 changes: 89 additions & 4 deletions schema/job.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,101 @@
"type": "object",
"allOf": [
{
"$ref": "job/base.json"
"description": "in-memory entity",
"$ref": "in_memory_entity/named_defaultable_has_metadata.json"
},
{
"description": "Compute Property Schema",
"$ref": "job/compute_property.json"
},
{
"$ref": "system/status_track.json"
}
],
"properties": {
"workflow": {
"description": "Arch-workflow for the job",
"$ref": "workflow.json"
},
"rmsId": {
"description": "Identity used to track jobs originated from command-line",
"type": "string"
},
"status": {
"description": "job status",
"enum": [
"pre-submission",
"queued",
"submitted",
"active",
"finished",
"terminate-queued",
"terminated",
"error",
"deleted",
"timeout"
]
},
"startTime": {
"description": "Approximate start time of the job. e.g. within 10 min",
"type": "string"
},
"workDir": {
"description": "The path to the working directory of this job, when the job originates from command-line",
"type": "string"
},
"_project": {
"description": "Subset of the full information about the project that this job belongs to.",
"$ref": "system/entity_reference.json"
},
"_material": {
"description": "Subset of the full information about the materials used inside this job.",
"$ref": "system/entity_reference.json"
},
"_materials": {
"description": "Subset of the full information about the materials used inside a multi-material job.",
"type": "array",
"items": {
"$ref": "system/entity_reference.json"
}
},
"_materialsSet": {
"description": "Subset of the full information about the materials set used inside a multi-material job.",
"$ref": "system/entity_reference.json"
},
"parent": {
"description": "Subset of the full information about the parent job for the job. Only a job from the same project can be assigned as a parent one.",
"$ref": "system/entity_reference.json"
},
"runtimeContext": {
"description": "Context variables that the job will have access to at runtime",
"type": "object"
},
"scopeTrack": {
"description": "history of the workflow scope on each update",
"type": "array",
"items": {
"type": "object",
"properties": {
"repetition": {
"type": "number"
},
"scope": {
"$ref": "workflow/scope.json"
}
}
}
},
"dataset": {
"description": "Dataset configuration for a data-driven job",
"$ref": "job/dataset.json"
},
"purged": {
"type": "boolean"
},
"purgedAt": {
"type": "number"
}
},
"required": [
"workflow"
]
"required": ["workflow", "status", "_project"]
}
80 changes: 0 additions & 80 deletions schema/job/base.json

This file was deleted.

37 changes: 37 additions & 0 deletions schema/job/dataset.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$id": "job/dataset",
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "job dataset schema",
"type": "object",
"properties": {
"datasetFilepath": {
"type": "string"
},
"datasetBasename": {
"type": "string"
},
"objectStorageContainerData": {
"type": "object",
"properties": {
"CONTAINER": {
"type": "string"
},
"NAME": {
"type": "string"
},
"PROVIDER": {
"type": "string"
},
"REGION": {
"type": "string"
},
"SIZE": {
"type": "string"
},
"TIMESTAMP": {
"type": "string"
}
}
}
}
}
40 changes: 0 additions & 40 deletions schema/system/job_extended.json

This file was deleted.

2 changes: 1 addition & 1 deletion schema/workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
],
"properties": {
"workflows": {
"description": "Array of workflows with the same schema as the current one.",
"description": "Array of workflows with the same schema as the current one. NOTE: items are not validated against the workflow schema itself (known limitation - see server/utils.ts's parseIncludeReferenceStatements for why, and consider fixing).",
"type": "array",
"items": {
"type": "object"
Expand Down
15 changes: 15 additions & 0 deletions src/js/esse/server/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ export function parseIncludeReferenceStatements(filePath: string): JSONSchema {
const originalId = parsed.$id;
let dereferenced = deref(parsed, { baseFolder: dirPath, removeIds: true });
// handle circular references and use non-dereferenced source
//
// KNOWN LIMITATION: this only catches a schema's own *direct* self-reference (e.g.
// workflow.json referencing itself). It does NOT handle a cycle reached transitively
// through another schema's own $ref (e.g. job.json -> $ref workflow.json -> $ref back to
// workflow.json) - in that case `deref` collapses the nested self-reference to `{}` (losing
// its $id) instead of throwing this same "Circular self reference" error, which crashes
// `JSONSchemasGenerator.writeResolvedSchemas` ("Schema ID is missing"). This is why
// `workflow.json`'s own `workflows` field is declared as `items: { type: "object" }` rather
// than a real `$ref` back to itself: consumers (wode's WorkflowSchema, jode's JobEntity,
// web-app's CoreJobSchema) hand-override the resulting lossy TS type with a properly
// recursive one, but that only fixes the TypeScript side - AJV validation of nested
// workflows' own structure is still effectively skipped. Fixing this for real means making
// this transitive case hit the same fallback as the direct case (probably by tracking
// visited $ids across the whole dereference walk, not just within a single file's own
// top-level deref call) - deferred for now.
if (dereferenced instanceof Error && dereferenced.message === "Circular self reference") {
dereferenced = parsed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/py/mat3ra/esse/data/schemas.py

Large diffs are not rendered by default.

Loading