Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Created December 13, 2013 13:50
Show Gist options
  • Save r7kamura/7944473 to your computer and use it in GitHub Desktop.
Save r7kamura/7944473 to your computer and use it in GitHub Desktop.

Qchan API

Provides Public API of Qchan.

Qchan is a project of a Job-Queue Worker System. It consists of a cluster of many processes and Qchan API is a member of them. Qchan API has a responsibility to provide Public REST API to the Qchan's internal processes and the other external clients via HTTP.

Resources

Qchan API manages the 3 types of resources: Job & Build & Subscription.

Job

Job is minimal managable unit for tasks in Qchan system. A Job has the following properties:

name type description
id integer the Job ID, unique in the all Jobs in the Qchan system

|id (integer): the Job ID, unique in the all Jobs in the Qchan system

  • children_ids (array of integer): an array of the following Job IDs
  • command (text): the actual shell-script that will be executed by Qchan's worker
  • succeess_count (integer): count of successes
  • failure_count (integer): count of failures
  • name (string): human-readable name
  • schedule (string): the scheduling for the job, in ISO8601 format like R10/2012-10-01T05:52:00Z/PT2S
  • 1st segment: number of times to repeat the job; put just 'R' to repeat forever
  • 2nd segment: the start time of the job
  • 3rd segment: the run interval

Build

Build is created for each execution of the Job, so we might say that there exists a relationship of "A Job has many Builds and a Build belongs to a Job". A Build has the following properties:

  • id (integer): the Build ID, unique in the all Builds in the Qchan system
  • exit_status (integer): the exit status of the build
  • job_id (integer): related Job's ID
  • number (integer): counting number, auto-incremented from 1 for each build of its job
  • output (text): stdout + stdout of the build

Subscription

Subscription is a unit of registrations to the Qchan system's pub-sub workers. A Subscription has the following properties:

  • id (integer): the Subscription ID, unique in the all Subscriptions in the Qchan system
  • type (string): a string property to identifier its event type
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment