pyfarm.master.api.jobgroups module¶
Job Groups¶
This module defines an API for managing and querying job groups
-
class
pyfarm.master.api.jobgroups.
JobGroupIndexAPI
[source]¶ Bases:
flask.views.MethodView
-
get
()[source]¶ A
GET
to this endpoint will return a list of known job groups.-
GET
/api/v1/jobgroups/ HTTP/1.1
¶ Request
GET /api/v1/jobgroups/ HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json [ { "id": 2, "user": "testuser", "main_jobtype": "Test JobType", "title": "Test Group" } ]
Statuscode 200: no error -
-
methods
= ['GET', 'POST']¶
-
post
()[source]¶ A
POST
to this endpoint will create a new job group.-
POST
/api/v1/jobgroups/ HTTP/1.1
¶ Request
POST /api/v1/jobgroups/ HTTP/1.1 Accept: application/json { "title": "Test Group", "user": "testuser", "main_jobtype": "Test JobType" }
Response
HTTP/1.1 201 CREATED Content-Type: application/json { "id": 2, "jobs": [], "user": "testuser", "main_jobtype": "Test JobType", "title": "Test Group" }
Statuscode 201: a new job group was created Statuscode 400: there was something wrong with the request (such as invalid columns being included) -
-
-
class
pyfarm.master.api.jobgroups.
JobsInJobGroupIndexAPI
[source]¶ Bases:
flask.views.MethodView
-
get
(group_id)[source]¶ A
GET
to this endpoint will return all jobs in the speicfied jobgroup.-
GET
/api/v1/jobgroups/<int:id>/jobs HTTP/1.1
¶ Request
GET /api/v1/jobgroups/2/jobs HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json { "jobs": [ { "id": "12345", "title": "Test Job", "state": "queued", "jobtype_id": 5, "jobtype": "Test Jobtype", "tasks_queued": 5, "tasks_running": 0, "tasks_done": 0, "tasks_failed": 0 } ] }
Statuscode 200: no error Statuscode 404: the requested job group was not found -
-
methods
= ['GET']¶
-
-
class
pyfarm.master.api.jobgroups.
SingleJobGroupAPI
[source]¶ Bases:
flask.views.MethodView
-
delete
(group_id)[source]¶ A
DELETE
to this endpoint will delete the specified job group-
DELETE
/api/v1/jobgroup/<int:id>
¶ Request
DELETE /api/v1/jobgroups/1 HTTP/1.1 Accept: application/json
Response
HTTP/1.1 204 NO_CONTENT
Statuscode 204: the job group was deleted or didn’t exist Statuscode 409: the job group cannot be deleted because it still contains jobs -
-
get
(group_id)[source]¶ A
GET
to this endpoint will return the requested job group-
GET
/api/v1/jobgroups/<int:id> HTTP/1.1
¶ Request
GET /api/v1/jobgroups/2 HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json { "id": 2, "user": "testuser", "main_jobtype": "Test JobType", "jobs": [], "title": "Test Group" }
Statuscode 200: no error Statuscode 404: the requested job group was not found -
-
methods
= ['DELETE', 'GET', 'POST']¶
-
post
(group_id)[source]¶ A
POST
to this endpoint will update the specified group with the data in the request. Columns not specified in the request will be left as they are.-
POST
/api/v1/jobgroups/<int:id> HTTP/1.1
¶ Request
POST /api/v1/jobgroups/2 HTTP/1.1 Accept: application/json { "user": "testuser2" }
Response
HTTP/1.1 201 OK Content-Type: application/json { "id": 2, "user": "testuser2", "main_jobtype": "Test JobType", "jobs": [], "title": "Test Group" }
Statuscode 200: the job group was updated Statuscode 400: there was something wrong with the request (such as invalid columns being included) -
-
-
pyfarm.master.api.jobgroups.
schema
()[source]¶ Returns the basic schema of
JobGroup
-
GET
/api/v1/jobgroups/schema HTTP/1.1
¶ Request
GET /api/v1/jobgroups/schema HTTP/1.1 Accept: application/json
Response
HTTP/1.1 200 OK Content-Type: application/json { "main_jobtype": "VARCHAR(64)", "title": "VARCHAR(255)", "user": "VARCHAR(255)", "id": "INTEGER" }
Statuscode 200: no error -