Skip to content

Commit

Permalink
core@ review workflow and job data models and their indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
imedina committed Sep 22, 2024
1 parent c248a37 commit f625346
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 140 deletions.
35 changes: 21 additions & 14 deletions opencga-catalog/src/main/resources/catalog-indexes.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
{"collections": ["note", "note_archive"], "fields": {"id": 1, "studyUid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"uid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"uuid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"scope": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"visibility": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"userId": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"tags": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"_creationDate": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"_modificationDate": 1, "studyUid": 1}, "options": {}}
{"collections": ["user"], "fields": {"id": 1}, "options": {"unique": true}}

{"collections": ["project"], "fields": {"id": 1}, "options": {"unique": true}}
{"collections": ["project"], "fields": {"uid": 1}, "options": {"unique": true}}
{"collections": ["project"], "fields": {"uuid": 1}, "options": {"unique": true}}
{"collections": ["project"], "fields": {"fqn": 1}, "options": {"unique": true}}

{"collections": ["user"], "fields": {"id": 1}, "options": {"unique": true}}

{"collections": ["study"], "fields": {"uid": 1}, "options": {"unique": true}}
{"collections": ["study"], "fields": {"uuid": 1}, "options": {"unique": true}}
{"collections": ["study"], "fields": {"fqn": 1}, "options": {"unique": true}}
Expand All @@ -31,14 +20,20 @@
{"collections": ["job"], "fields": {"id": 1, "studyUid": 1}, "options": {"unique": true}}
{"collections": ["job"], "fields": {"tool.id": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"tool.type": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"tool.externalExecutor.id": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"userId": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"parentId": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"dependsOn.id": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"outDir.uid": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"input.uid": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"output.uid": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"outDir.uid": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"priority": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"tags": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"dryRun: 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"visited": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"internal.status.id": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"internal.status.id": 1, "_priority": 1, "_creationDate": 1}, "options": {}}
{"collections": ["job"], "fields": {"internal.killJobRequested": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"_priority": 1, "_creationDate": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"_priority": 1, "studyUid": 1}, "options": {}}
{"collections": ["job"], "fields": {"_creationDate": 1, "studyUid": 1}, "options": {}}
Expand Down Expand Up @@ -261,14 +256,26 @@
{"collections": ["audit"], "fields": {"status.name": 1, "studyUuid": 1}, "options": {}}
{"collections": ["audit"], "fields": {"date": 1, "studyUuid": 1}, "options": {}}

{"collections": ["note", "note_archive"], "fields": {"id": 1, "studyUid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"uid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"uuid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["note", "note_archive"], "fields": {"scope": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"visibility": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"userId": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"tags": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"_creationDate": 1, "studyUid": 1}, "options": {}}
{"collections": ["note", "note_archive"], "fields": {"_modificationDate": 1, "studyUid": 1}, "options": {}}

{"collections": ["workflow", "workflow_archive"], "fields": {"uid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["workflow", "workflow_archive"], "fields": {"id": 1, "studyUid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["workflow", "workflow_archive"], "fields": {"uuid": 1, "version": 1}, "options": {"unique": true}}
{"collections": ["workflow", "workflow_archive"], "fields": {"name": 1, "studyUid": 1}, "options": {"unique": true}}
{"collections": ["workflow", "workflow_archive"], "fields": {"type": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"manager.id": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"tags": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"scripts.fileName": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"draft": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"scripts.fileName": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"internal.registrationUserId": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"_creationDate": 1, "studyUid": 1}, "options": {}}
{"collections": ["workflow", "workflow_archive"], "fields": {"_modificationDate": 1, "studyUid": 1}, "options": {}}
2 changes: 1 addition & 1 deletion opencga-client/src/main/javascript/Workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Workflow extends OpenCGAParentClass {
create(data, params) {
return this._post("workflows", null, null, null, "create", data, params);
}
#

/** Workflow distinct method
* @param {String} field - Comma separated list of fields for which to obtain the distinct values.
* @param {Object} [params] - The Object containing the following optional parameters:
Expand Down
127 changes: 34 additions & 93 deletions opencga-core/src/main/java/org/opencb/opencga/core/models/job/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,150 +28,91 @@
import java.util.List;
import java.util.Map;

/**
* Created by jacobo on 11/09/14.
*/
@DataClass(id = "Job", since = "1.0",
description = "Job data model hosts information about any job.")

@DataClass(id = "Job", since = "1.0.0", description = "Job data model hosts information about any job.")
public class Job extends PrivateStudyUid {

public static final String OPENCGA_PARENTS = "OPENCGA_PARENTS";
/**
* Job ID is a mandatory parameter when creating a new sample, this ID cannot be changed at the moment.
*
* @apiNote Required, Immutable, Unique
*/

@DataField(id = "id", required = true, indexed = true, unique = true, immutable = true,
description = FieldConstants.GENERIC_ID_DESCRIPTION)
private String id;
/**
* Global unique ID at the whole OpenCGA installation. This is automatically created during the sample creation and cannot be changed.
*
* @apiNote Internal, Unique, Immutable
*/

@DataField(id = "uuid", managed = true, indexed = true, unique = true, immutable = true,
description = FieldConstants.GENERIC_UUID_DESCRIPTION)
private String uuid;
/**
* An string to describe the properties of the Job.
*
* @apiNote
*/
@DataField(id = "description", defaultValue = "No description available",
description = FieldConstants.GENERIC_DESCRIPTION_DESCRIPTION)

@DataField(id = "description", defaultValue = "", description = FieldConstants.GENERIC_DESCRIPTION_DESCRIPTION)
private String description;

@DataField(id = "tool", indexed = true,
description = FieldConstants.JOB_TOOL)
@DataField(id = "tool", indexed = true, description = FieldConstants.JOB_TOOL)
private ToolInfo tool;

@DataField(id = "userId", indexed = true,
description = FieldConstants.JOB_USER_ID)
@DataField(id = "study", indexed = true, description = FieldConstants.JOB_STUDY)
private JobStudyParam study;

@DataField(id = "userId", indexed = true, description = FieldConstants.JOB_USER_ID)
private String userId;

@DataField(id = "commandLine", indexed = true,
description = FieldConstants.JOB_COMMAND_LINE)
@DataField(id = "commandLine", indexed = true, description = FieldConstants.JOB_COMMAND_LINE)
private String commandLine;

@DataField(id = "params", indexed = true,
description = FieldConstants.JOB_PARAMS)
@DataField(id = "params", indexed = true, description = FieldConstants.JOB_PARAMS)
private Map<String, Object> params;
/**
* String representing when the Cohort was created, this is automatically set by OpenCGA.
*
* @apiNote Internal
*/
@DataField(id = "creationDate", indexed = true,
description = FieldConstants.GENERIC_CREATION_DATE_DESCRIPTION)

@DataField(id = "creationDate", indexed = true, description = FieldConstants.GENERIC_CREATION_DATE_DESCRIPTION)
private String creationDate;
/**
* String representing when was the last time the Cohort was modified, this is automatically set by OpenCGA.
*
* @apiNote Internal
*/
@DataField(id = "modificationDate", indexed = true, since = "1.0",
description = FieldConstants.GENERIC_MODIFICATION_DATE_DESCRIPTION)
private String modificationDate;

@DataField(id = "modificationDate", indexed = true, since = "1.0", description = FieldConstants.GENERIC_MODIFICATION_DATE_DESCRIPTION)
private String modificationDate;

@DataField(id = "priority", indexed = true,
description = FieldConstants.JOB_PRIORITY_DESCRIPTION)
@DataField(id = "priority", indexed = true, description = FieldConstants.JOB_PRIORITY_DESCRIPTION)
private Enums.Priority priority;

/**
* An object describing the internal information of the Sample. This is managed by OpenCGA.
*
* @apiNote Internal
*/

@DataField(id = "release", indexed = true,
description = FieldConstants.GENERIC_RELEASE_DESCRIPTION)
@DataField(id = "release", indexed = true, description = FieldConstants.GENERIC_RELEASE_DESCRIPTION)
private JobInternal internal;

@DataField(id = "outDir", indexed = true,
description = FieldConstants.JOB_OUT_DIR_DESCRIPTION)
@DataField(id = "outDir", indexed = true, description = FieldConstants.JOB_OUT_DIR_DESCRIPTION)
private File outDir;

@DataField(id = "input", indexed = true,
description = FieldConstants.JOB_INPUT_DESCRIPTION)
private List<File> input; // input files to this job
@DataField(id = "input", indexed = true, description = FieldConstants.JOB_INPUT_DESCRIPTION)
private List<File> input;

@DataField(id = "output", indexed = true,
description = FieldConstants.JOB_OUTPUT_DESCRIPTION)
private List<File> output; // output files of this job
@DataField(id = "output", indexed = true, description = FieldConstants.JOB_OUTPUT_DESCRIPTION)
private List<File> output;

@DataField(id = "tags", indexed = true,
description = FieldConstants.JOB_TAGS_DESCRIPTION)
@DataField(id = "tags", indexed = true, description = FieldConstants.JOB_TAGS_DESCRIPTION)
private List<String> tags;

@DataField(id = "dependsOn", indexed = true,
description = FieldConstants.JOB_DEPENDS_ON_DESCRIPTION)
@DataField(id = "dependsOn", indexed = true, description = FieldConstants.JOB_DEPENDS_ON_DESCRIPTION)
private List<Job> dependsOn;

@DataField(id = FieldConstants.JOB_PARENT_ID, indexed = false, since = "3.2.0",
description = FieldConstants.JOB_PARENT_ID_DESCRIPTION)
@DataField(id = FieldConstants.JOB_PARENT_ID, indexed = true, since = "3.2.0", description = FieldConstants.JOB_PARENT_ID_DESCRIPTION)
private String parentId;

@DataField(id = FieldConstants.JOB_SCHEDULED_START_TIME, indexed = false, since = "3.2.0",
@DataField(id = FieldConstants.JOB_SCHEDULED_START_TIME, since = "3.2.0",
description = FieldConstants.JOB_SCHEDULED_START_TIME_DESCRIPTION)
private String scheduledStartTime;

@DataField(id = ParamConstants.JOB_DRY_RUN, since = "3.2.0", description = ParamConstants.JOB_DRY_RUN_DESCRIPTION)
private boolean dryRun;

@DataField(id = "execution", indexed = true,
description = FieldConstants.JOB_EXECUTION_DESCRIPTION)
@DataField(id = "execution", indexed = true, description = FieldConstants.JOB_EXECUTION_DESCRIPTION)
private ExecutionResult execution;

@DataField(id = "stdout", indexed = true,
description = FieldConstants.JOB_STDOUT_DESCRIPTION)
@DataField(id = "stdout", indexed = true, description = FieldConstants.JOB_STDOUT_DESCRIPTION)
private File stdout;

@DataField(id = "stderr", indexed = true,
description = FieldConstants.JOB_STDERR_DESCRIPTION)
@DataField(id = "stderr", indexed = true, description = FieldConstants.JOB_STDERR_DESCRIPTION)
private File stderr;


@DataField(id = "visited", indexed = true,
description = FieldConstants.JOB_VISITED)
@DataField(id = "visited", indexed = true, description = FieldConstants.JOB_VISITED)
private boolean visited;
/**
* An integer describing the current data release.
*
* @apiNote Internal
*/

@DataField(id = "release", indexed = true,
description = FieldConstants.GENERIC_RELEASE_DESCRIPTION)
private int release;

@DataField(id = "study", indexed = true,
description = FieldConstants.JOB_STUDY)
private JobStudyParam study;
@DataField(id = "release", indexed = true, description = FieldConstants.GENERIC_RELEASE_DESCRIPTION)
private int release;

@DataField(id = "attributes", indexed = true,
description = FieldConstants.GENERIC_ATTRIBUTES_DESCRIPTION)
@DataField(id = "attributes", indexed = true, description = FieldConstants.GENERIC_ATTRIBUTES_DESCRIPTION)
private Map<String, Object> attributes;

public Job() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@

public class JobInternal extends Internal implements Cloneable {

@DataField(id = "status", indexed = true,
description = FieldConstants.JOB_INTERNAL_STATUS_DESCRIPTION)
@DataField(id = "status", indexed = true, description = FieldConstants.JOB_INTERNAL_STATUS_DESCRIPTION)
private Enums.ExecutionStatus status;

@DataField(id = "webhook", indexed = true,
description = FieldConstants.JOB_INTERNAL_WEBHOOK_DESCRIPTION)
@DataField(id = "webhook", indexed = true, description = FieldConstants.JOB_INTERNAL_WEBHOOK_DESCRIPTION)
private JobInternalWebhook webhook;

//TODO add tags to commons-datastore-core
@DataField(id = "events", indexed = true, uncommentedClasses = {"Event"},
description = FieldConstants.JOB_INTERNAL_EVENTS_DESCRIPTION)
@DataField(id = "events", indexed = true, uncommentedClasses = {"Event"}, description = FieldConstants.JOB_INTERNAL_EVENTS_DESCRIPTION)
private List<Event> events;

@DataField(id = "killJobRequested", indexed = false, since = "3.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class ToolInfo {
@DataField(id = "resource", description = FieldConstants.TOOL_INFO_RESOURCE_DESCRIPTION)
private Enums.Resource resource;

@DataField(id = "resource", description = FieldConstants.TOOL_INFO_EXTERNAL_EXECUTOR_DESCRIPTION)
@DataField(id = "externalExecutor", since = "3.3.0", description = FieldConstants.TOOL_INFO_EXTERNAL_EXECUTOR_DESCRIPTION)
private ToolInfoExecutor externalExecutor;


Expand Down
Loading

0 comments on commit f625346

Please sign in to comment.