Skip to content

Commit

Permalink
Merge 3cdf4d7 into dfa2e19
Browse files Browse the repository at this point in the history
  • Loading branch information
Diego committed May 11, 2017
2 parents dfa2e19 + 3cdf4d7 commit 1cc70c1
Show file tree
Hide file tree
Showing 11 changed files with 603 additions and 174 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ include COPYING
include *.rst
include *.sh
include pytest.ini
include docs/openapi.json
recursive-include reana_job_controller *.json
recursive-include docs *.py
recursive-include docs *.png
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinxcontrib.httpdomain',
'sphinxcontrib.openapi'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down
234 changes: 234 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
{
"parameters": {},
"definitions": {
"Job": {
"properties": {
"cmd": {
"type": "string"
},
"max_restart_count": {
"format": "int32",
"type": "integer"
},
"cvmfs_mounts": {
"items": {
"type": "string"
},
"type": "array"
},
"experiment": {
"type": "string"
},
"restart_count": {
"format": "int32",
"type": "integer"
},
"status": {
"type": "string"
},
"docker_img": {
"type": "string"
},
"job_id": {
"type": "string"
}
},
"required": [
"cmd",
"cvmfs_mounts",
"docker_img",
"experiment",
"job_id",
"max_restart_count",
"restart_count",
"status"
],
"type": "object"
},
"JobRequest": {
"properties": {
"env_vars": {
"type": "object"
},
"cmd": {
"type": "string"
},
"experiment": {
"type": "string"
},
"shared_file_system": {
"type": "boolean"
},
"cvmfs_mounts": {
"items": {
"type": "string"
},
"type": "array"
},
"docker_img": {
"type": "string"
},
"job_id": {
"format": "uuid",
"type": "string"
}
},
"required": [
"docker_img",
"experiment"
],
"type": "object"
}
},
"tags": [],
"swagger": "2.0",
"paths": {
"/jobs": {
"get": {
"produces": [
"application/json"
],
"responses": {
"200": {
"examples": {
"application/json": {
"jobs": {
"2e4bbc1d-db5e-4ee0-9701-6e2b1ba55c20": {
"cmd": "sleep 1000",
"max_restart_count": 3,
"restart_count": 0,
"cvmfs_mounts": [
"atlas-condb",
"atlas"
],
"experiment": "atlas",
"docker_img": "busybox",
"job_id": "2e4bbc1d-db5e-4ee0-9701-6e2b1ba55c20",
"status": "started"
},
"1612a779-f3fa-4344-8819-3d12fa9b9d90": {
"cmd": "sleep 1000",
"max_restart_count": 3,
"restart_count": 0,
"cvmfs_mounts": [
"atlas-condb",
"atlas"
],
"experiment": "atlas",
"docker_img": "busybox",
"job_id": "1612a779-f3fa-4344-8819-3d12fa9b9d90",
"status": "succeeded"
}
}
}
},
"schema": {
"items": {
"$ref": "#/definitions/Job"
},
"type": "array"
},
"description": "Job list."
}
},
"description": "Get all Jobs"
},
"post": {
"operationId": "create_job",
"produces": [
"application/json"
],
"responses": {
"400": {
"description": "Invalid request - probably malformed JSON"
},
"201": {
"examples": {
"application/json": {
"job_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac"
}
},
"schema": {
"properties": {
"job_id": {
"type": "string"
}
},
"type": "object"
},
"description": "The Job has been created."
},
"500": {
"description": "Internal error - probably the job could not be allocated"
}
},
"parameters": [
{
"required": true,
"in": "body",
"schema": {
"$ref": "#/definitions/JobRequest"
},
"name": "job",
"description": "Information needed to instantiate a Job"
}
],
"summary": "This resource is expecting JSON data with all the necessary\ninformation of a new job.",
"description": "Create a new Job.",
"consumes": [
"application/json"
]
}
},
"/jobs/{job_id}": {
"get": {
"produces": [
"application/json"
],
"responses": {
"200": {
"examples": {
"application/json": {
"job": {
"cmd": "sleep 1000",
"max_restart_count": 3,
"restart_count": 0,
"cvmfs_mounts": [
"atlas-condb",
"atlas"
],
"experiment": "atlas",
"docker_img": "busybox",
"job_id": "cdcf48b1-c2f3-4693-8230-b066e088c6ac",
"status": "started"
}
}
},
"schema": {
"$ref": "#/definitions/Job"
},
"description": "The Job."
},
"404": {
"description": "The Job does not exist."
}
},
"parameters": [
{
"in": "path",
"required": true,
"name": "job_id",
"description": "ID of the Job",
"type": "string"
}
],
"description": "Get a Job by its id"
}
}
},
"info": {
"title": "reana-job-controller",
"description": "REANA Job Controller API",
"version": "0.0.1"
}
}
15 changes: 1 addition & 14 deletions docs/restapi.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
REST API
========

GET /jobs
---------

.. autofunction:: reana_job_controller.app.get_jobs

POST /jobs
----------

.. autofunction:: reana_job_controller.app.create_job

GET /jobs/<job_id>
------------------

.. autofunction:: reana_job_controller.app.get_job
.. openapi:: openapi.json

0 comments on commit 1cc70c1

Please sign in to comment.