# Job

## Overview

Job data model hosts information about any job.

### Summary

| Field            |                                         Create                                        |                                         Update                                        |                                         Unique                                        |                                        Required                                       |
| ---------------- | :-----------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------: |
| id               | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |
| uuid             |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| description      | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| tool             | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| userId           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| commandLine      | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| params           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| creationDate     | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| modificationDate | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| priority         | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| release          | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| outDir           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| input            | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| output           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| tags             | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| dependsOn        | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| execution        | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| stdout           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| stderr           | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| visited          | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| release          | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| study            | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |
| attributes       | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) | ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/yes.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |  ![](https://github.com/opencb/opencga/blob/develop/docs/data-models/no.png?raw=true) |

## Data Model

### Job

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/job/Job.java).

| Field                                                                                                                                           | Description                                                                                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>id</strong><br><em>String</em><br></p>                                                                                               | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment.                        |
| <p><strong>uuid</strong><br><em>String</em><br></p>                                                                                             | Unique 32-character identifier assigned automatically by OpenCGA.                                                           |
| <p><strong>description</strong><br><em>String</em><br></p>                                                                                      | Users may provide a description for the entry.                                                                              |
| <p><strong>tool</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#toolinfo"><em>ToolInfo</em></a><br></p>                    | Job tool info.                                                                                                              |
| <p><strong>userId</strong><br><em>String</em><br></p>                                                                                           | Job user id.                                                                                                                |
| <p><strong>commandLine</strong><br><em>String</em><br></p>                                                                                      | Job command line.                                                                                                           |
| <p><strong>params</strong><br><em>Map\<String,Object></em><br></p>                                                                              | Job params.                                                                                                                 |
| <p><strong>creationDate</strong><br><em>String</em><br></p>                                                                                     | Autogenerated date following the format YYYYMMDDhhmmss containing the date when the entry was first registered.             |
| <p><strong>modificationDate</strong><br><em>String</em><br><br><em>since</em>: 1.0</p>                                                          | Autogenerated date following the format YYYYMMDDhhmmss containing the date when the entry was last modified.                |
| <p><strong>priority</strong><br><em>Priority</em><br></p>                                                                                       | Job priority.                                                                                                               |
| <p><strong>release</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#jobinternal"><em>JobInternal</em></a><br></p>           | An integer describing the current data release.                                                                             |
| <p><strong>outDir</strong><br><a href="https://docs.opencga.opencb.org/data-models/file"><em>File</em></a><br></p>                              | Output dir for the job.                                                                                                     |
| <p><strong>input</strong><br><em>List<</em><a href="https://docs.opencga.opencb.org/data-models/file"><em>File</em></a><em>></em><br></p>       | List of input files.                                                                                                        |
| <p><strong>output</strong><br><em>List<</em><a href="https://docs.opencga.opencb.org/data-models/file"><em>File</em></a><em>></em><br></p>      | List of output files.                                                                                                       |
| <p><strong>tags</strong><br><em>List\<String></em><br></p>                                                                                      | List of tags for the job.                                                                                                   |
| <p><strong>dependsOn</strong><br><em>List<</em><a href="https://docs.opencga.opencb.org/data-models/job"><em>Job</em></a><em>></em><br></p>     | List of jobs the current job depends on.                                                                                    |
| <p><strong>execution</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#executionresult"><em>ExecutionResult</em></a><br></p> | Result of the execution.                                                                                                    |
| <p><strong>stdout</strong><br><a href="https://docs.opencga.opencb.org/data-models/file"><em>File</em></a><br></p>                              | Standard out file.                                                                                                          |
| <p><strong>stderr</strong><br><a href="https://docs.opencga.opencb.org/data-models/file"><em>File</em></a><br></p>                              | Standard error file.                                                                                                        |
| <p><strong>visited</strong><br><em>boolean</em><br></p>                                                                                         | Boolean that represents if the job has been visited or not.                                                                 |
| <p><strong>release</strong><br><em>int</em><br></p>                                                                                             | An integer describing the current data release.                                                                             |
| <p><strong>study</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#jobstudyparam"><em>JobStudyParam</em></a><br></p>         | Job study.                                                                                                                  |
| <p><strong>attributes</strong><br><em>Map\<String,Object></em><br></p>                                                                          | You can use this field to store any other information, keep in mind this is not indexed so you cannot search by attributes. |

### ExecutionResult

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/tools/result/ExecutionResult.java).

| Field                                                                                                                                                 | Description                                                                                                                 |
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>id</strong><br><em>String</em><br></p>                                                                                                     | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment.                        |
| <p><strong>executor</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#executorinfo"><em>ExecutorInfo</em></a><br></p>              | Object describes execution information.                                                                                     |
| <p><strong>start</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#date"><em>Date</em></a><br></p>                                 | Date the execution started.                                                                                                 |
| <p><strong>end</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#date"><em>Date</em></a><br></p>                                   | Date the execution was completed.                                                                                           |
| <p><strong>status</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#status"><em>Status</em></a><br></p>                            | Executor status can have the values PENDING, RUNNING, DONE and ERROR.                                                       |
| <p><strong>externalFiles</strong><br><em>List<</em><a href="https://docs.opencga.opencb.org/data-models/job#uri"><em>URI</em></a><em>></em><br></p>   | List of uris to the external files.                                                                                         |
| <p><strong>steps</strong><br><em>List<</em><a href="https://docs.opencga.opencb.org/data-models/job#toolstep"><em>ToolStep</em></a><em>></em><br></p> | List of ToolStep.                                                                                                           |
| <p><strong>events</strong><br><em>List\<Event></em><br></p>                                                                                           | List of Event.                                                                                                              |
| <p><strong>attributes</strong><br><em>ObjectMap</em><br></p>                                                                                          | You can use this field to store any other information, keep in mind this is not indexed so you cannot search by attributes. |

### JobStudyParam

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/job/JobStudyParam.java).

| Field                                                        | Description                                                                                          |
| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
| <p><strong>id</strong><br><em>String</em><br></p>            | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment. |
| <p><strong>others</strong><br><em>List\<String></em><br></p> | List of strings.                                                                                     |

### ToolInfo

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/job/ToolInfo.java).

| Field                                                      | Description                                                                                                                                                                                                                          |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| <p><strong>id</strong><br><em>String</em><br></p>          | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment.                                                                                                                                 |
| <p><strong>description</strong><br><em>String</em><br></p> | Users may provide a description for the entry.                                                                                                                                                                                       |
| <p><strong>scope</strong><br><em>Scope</em><br></p>        | Tool info scope can have the values GLOBAL, PROJECT and STUDY.                                                                                                                                                                       |
| <p><strong>type</strong><br><em>Type</em><br></p>          | Tool info type can have the values OPERATION and ANALYSIS.                                                                                                                                                                           |
| <p><strong>resource</strong><br><em>Resource</em><br></p>  | Tool info resource can have the values AUDIT, USER, PROJECT, STUDY, FILE, SAMPLE, JOB, INDIVIDUAL, COHORT, DISEASE\_PANEL, FAMILY, CLINICAL\_ANALYSIS, INTERPRETATION, VARIANT, ALIGNMENT, CLINICAL, EXPRESSION, RGA and FUNCTIONAL. |

### JobInternal

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/job/JobInternal.java).

| Field                                                                                                                                               | Description                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| <p><strong>status</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#executionstatus"><em>ExecutionStatus</em></a><br></p>        | Job internal status can have the values PENDING, QUEUED, RUNNING, DONE, ERROR, UNKNOWN, REGISTERING, UNREGISTERED, ABORTED, DELETED. |
| <p><strong>webhook</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#jobinternalwebhook"><em>JobInternalWebhook</em></a><br></p> | Job internal Webhook.                                                                                                                |
| <p><strong>events</strong><br><em>List\<Event></em><br></p>                                                                                         | Events of the internal job.                                                                                                          |
| <p><strong>status</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#internalstatus"><em>InternalStatus</em></a><br></p>          | Status of the internal object.                                                                                                       |
| <p><strong>registrationDate</strong><br><em>String</em><br></p>                                                                                     | Registration date of the internal object.                                                                                            |
| <p><strong>lastModified</strong><br><em>String</em><br></p>                                                                                         | Date of the last modification of the internal object.                                                                                |

### Status

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/tools/result/Status.java).

### InternalStatus

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/common/InternalStatus.java).

### JobInternalWebhook

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/job/JobInternalWebhook.java).

| Field                                                                                                                 | Description                                              |
| --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| <p><strong>webhook</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#url"><em>URL</em></a><br></p> | Webhook URL.                                             |
| <p><strong>status</strong><br><em>Map\<String,Status></em><br></p>                                                    | Webhook status map can have the values SUCCESS or ERROR. |

### ToolStep

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/tools/result/ToolStep.java).

| Field                                                                                                                 | Description                                                                                                                 |
| --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| <p><strong>id</strong><br><em>String</em><br></p>                                                                     | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment.                        |
| <p><strong>start</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#date"><em>Date</em></a><br></p> | Date the execution started.                                                                                                 |
| <p><strong>end</strong><br><a href="https://docs.opencga.opencb.org/data-models/job#date"><em>Date</em></a><br></p>   | Date the execution was completed.                                                                                           |
| <p><strong>status</strong><br><em>Type</em><br></p>                                                                   | Executor status can have the values PENDING, RUNNING, DONE and ERROR.                                                       |
| <p><strong>attributes</strong><br><em>ObjectMap</em><br></p>                                                          | You can use this field to store any other information, keep in mind this is not indexed so you cannot search by attributes. |

### URI

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/java/net/URI.java).

### Date

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/java/util/Date.java).

### ExecutionStatus

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/models/common/Enums/ExecutionStatus.java).

### ExecutorInfo

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/org/opencb/opencga/core/tools/result/ExecutorInfo.java).

| Field                                                       | Description                                                                                          |
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| <p><strong>id</strong><br><em>String</em><br></p>           | Object ID is a mandatory parameter when creating a new one, this ID cannot be changed at the moment. |
| <p><strong>clazz</strong><br><em>String</em><br></p>        | ExecutorInfo class.                                                                                  |
| <p><strong>params</strong><br><em>ObjectMap</em><br></p>    | ExecutorInfo params.                                                                                 |
| <p><strong>source</strong><br><em>Source</em><br></p>       | Executor info source can have the values FILE, PARQUET\_FILE, MONGODB, HBASE, STORAGE.               |
| <p><strong>framework</strong><br><em>Framework</em><br></p> | Executor info framework can have the values LOCAL, MAP\_REDUCE, SPARK.                               |

### URL

You can find the Java code [here](https://github.com/opencb/opencga/tree/TASK-1587/opencga-core/src/main/java/java/net/URL.java).
