Organization Job Resource

OrgJobs represent long running asynchronous processes. Each job can have several tasks that run in parallel in different processes or servers. For example, a component reconcile job will reconcile each stream as a task. A component's streams are reconciled at the same time possibly across several servers.

Note that org_job entities have a time-to-live at 30 days. That is, if the user doesn't delete an org_job, it will automatically be deleted after 30 days.

An org_job might have errors but the job can be marked as FINISHED_SUCCESS. This is because the GroveStreams' job framework will retry a task several times if it keeps generating errors until it reaches the retry amount or the task succeeds.

Job status types:
  • SETTING_UP
  • RUNNING
  • CLEANING_UP
  • FINISHED_SUCCESS
  • FINISHED_FAILURE
  • FINISHED_CANCELLED


GET org_job/{org_jobUid}



Get the organization job with the specified uid. Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible? Yes

Resource URL

http://grovestreams.com/api/org_job/{org_jobUid}

Parameters

none


Example Requests

/org_job/8af0bfc0-2ce8-47a9-be96-5754ea734c1a

Response Body
{
  "message": "",
  "org_job": {
    "progress": 0.10000000149011612,
    "uid": "8af0bfc0-2ce8-47a9-be96-5754ea734c1a",
    "startDate": 1262304000000,
    "details": "reconcile details",
    "status": "SETTING_UP",
    "name": "reconcile",
    "acknowledged": false,
    "endDate": 1262304001000
  },
  "success": true
}


GET org_job/new



Returns a default org_job entity with a unique UID. Does not persist the new org_job entity. It's the callers responsibility to PUT the new org_job and register it.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes
org token required? Yes

Resource URL

http://grovestreams.com/api/org_job/new

Parameters

none

Example Requests

/org_job/new

Response Body

{
  "message": "",
  "org_job": {
    "progress": 0,
    "uid": "8af0bfc0-2ce8-47a9-be96-5754ea734c1a",
    "startDate": 0,
    "details": "0",
    "status": "SETTING_UP",
    "acknowledged": false,
    "name": "",
    "endDate": 0
  },
  "success": true
}


GET org_job   



Returns a list of org_job resources.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

http://grovestreams.com/api/org_job

Parameters

filter optional Applies enabled filters. Defaults to false if missing.

Example Requests

/org_job

Response Body

{
  "message": "",
  "org_job": [
    {
      "progress": 0.10000000149011612,
      "uid": "7b904368-a86d-472b-8261-abb1ff477a4e",
      "startDate": 1262304000000,
      "details": "reconcile details",
      "status": "SETTING_UP",
      "name": "reconcile",
      "acknowledged": false,
      "endDate": 1262304001000
    },
    {
      "progress": 0.10000000149011612,
      "uid": "c750b5f8-cfdd-43fd-bcfa-c231e8835048",
      "startDate": 1262304000000,
      "details": "reconcile details",
      "status": "SETTING_UP",
      "name": "reconcile",
      "acknowledged": false,
      "endDate": 1262304001000
    }
  ],
  "totalCount": 2,
  "success": true
}


GET org_job/{org_jobUid}/status



Return the status of an org_job.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible? Yes

Resource URL

http://grovestreams.com/api/org_job/{org_jobUid}/status

Parameters

none

Example Requests

org_job/636a749c-f4c6-4b4a-a8bf-7bb0ed58a751/status

Response Body

{
  "message": "",
  "org_job": {
    "progress": 0.10000000149011612,
    "uid": "e104c44e-7b72-4bc1-be84-1d17d4a28477",
    "errCount": 0,
    "status": "SETTING_UP",
    "acknowledged": false,
    "endDate": 1262304001000
  },
  "success": true
}


GET org_job/{org_jobUid}/errors



Returns errors for a job. Errors can be retrieved while a job is running or after it is done running.

Each error is a stack trace and can be lengthy. Some jobs can have millions of tasks and failed tasks can be retried several times so the amount of errors per job can be more than the number of tasks and be in the millions thus we have a start and limit on this collection to allow for pagination.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible? Yes

Resource URL

http://grovestreams.com/api/org_job/{org_jobUid}/errors

Parameters

start required
Zero-based offset from start of list.
limit
required Set this to the maximum number of results to return. Restricted to 10,000.

Example Requests

org_job/636a749c-f4c6-4b4a-a8bf-7bb0ed58a751/errors?start=0&limit=1000

Response Body

{
  "message": "",
  "org_job": [
    {
      "id": 0,
      "error": "exception.LabradorException: Unit test error in job<br/>com.grovestreams.labrador.utility.Validator.throwErr(Validator.java:15)<br/>com.grovestreams.testJobs.ErrorJob$ErrorMapper.map(ErrorJob.java:109)<br/>com.grovestreams.testJobs.ErrorJob$ErrorMapper.map(ErrorJob.java:1)
    },
    {
      "id": 1,
      "error": "exception.LabradorException: Unit test error in job<br/>com.grovestreams.labrador.utility.Validator.throwErr(Validator.java:15)<br/>com.grovestreams.testJobs.ErrorJob$ErrorMapper.map(ErrorJob.java:109)<br/>com.grovestreams.testJobs.ErrorJob$ErrorMapper.map(ErrorJob.java:1)"
    }
  ],
  "totalErrorCount": 2,
  "success": true
}



POST org_job/{org_jobUid}/cancel



Cancels a running org_job and marks it as FINISHED_CANCELLED. Tasks that are running when the call is made are allowed to finish. No new tasked are created.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes
org token required? Yes

Resource URL

http://grovestreams.com/api/org_job{org_jobUid}/cancel

Parameters

none

Example Requests

/org_job/8af0bfc0-2ce8-47a9-be96-5754ea734c1a/cancel

Response Body
{
  "message": "Marked OrgJob 8af0bfc0-2ce8-47a9-be96-5754ea734c1a for cancellation'",
  "success": true
}


DELETE org_job/{org_jobUid}



Deletes an org_job. Will cancel a running job before it deletes it.
Resource Information
Rate Limited? Yes
session, oauth and org tokens compatible? Yes
api_key compatible Yes

Resource URL

http://grovestreams.com/api/organization/{organizationUid}

Parameters

none

Example Requests

/organization/8af0bfc0-2ce8-47a9-be96-5754ea734c1a

Response Body
{
  "message": "Deleted OrgJob with uid '8af0bfc0-2ce8-47a9-be96-5754ea734c1a'",
  "success": true
}