trckpd

POST _/job/

@See Jobs

Creates a job and persists in the database. It assigns a id to the new job, id is an UUID string. It returns a JSON object which contains the the job id.

Behind the scene

A job does not get scheduled to run immediately. A background daemon, task-daemon, will poll the database intermittently to find new jobs. The daemon will then split the job in tasks. Tasks usually will correspond to a document. Tasks are ephemeral, not persisted in database, are created on etcd.

Path Parameters :

  • None

Request Headers :

  • Accept: application/json
  • Content-Type: application/json

JSON Body Parameters :

  • name (string) : Name of the job, assigned by user, can be duplicate.
  • type (string) : Type of the job, values could be one of ALL, REFRESH, ERROR. ALL, will create new documents, update old ones from the specified source. REFRESH, will update old documents from the specified source. ERROR, will try to update old documents which failed to get previously.
  • range (string array) : Document titles, or characters at starting position of titles, eg. ‘ne’ to ‘pq’, defines the range of documents to be used for the job.
  • source (string) : Source of the documents, can be one of WIKIPEDIA, GUTENBERG, YOUTUBE.
  • sched (boolean) : true, if the job is to be run periodically. false, if the job is run once.
  • freq (int) : If sched is true, then this number is the number of days between two runs of the job. Default is 15. If sched is false, then this value is ignored.

Response Headers :

  • Accept: application/json
  • Content-Type: application/json

Response JSON Object :

  • _id (string) : Job id, UUID string.

Status Codes :

  • 201 Created : Job created and stored in database.
  • 400 Bad Request : Invalid request body or parameters.
  • 500 Server Error : Server failed, try later.