pyfarm.master.api.jobqueues module

Job Queues

This module defines an API for managing and querying job queues

class pyfarm.master.api.jobqueues.JobQueueIndexAPI[source]

Bases: flask.views.MethodView

get()[source]

A GET to this endpoint will return a list of known job queues.

GET /api/v1/jobqueues/ HTTP/1.1

Request

GET /api/v1/jobqueues/ HTTP/1.1
Accept: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

[
    {
        "priority": 5,
        "weight": 10,
        "parent_jobqueue_id": null,
        "name": "Test Queue",
        "minimum_agents": null,
        "id": 1,
        "maximum_agents": null
    },
    {
        "priority": 5,
        "weight": 10,
        "parent_jobqueue_id": null,
        "name": "Test Queue 2",
        "minimum_agents": null,
        "id": 2,
        "maximum_agents": null
    }
]
Statuscode 200:no error
methods = ['GET', 'POST']
post()[source]

A POST to this endpoint will create a new job queue.

POST /api/v1/jobqueues/ HTTP/1.1

Request

POST /api/v1/jobqueues/ HTTP/1.1
Accept: application/json

{
    "name": "Test Queue"
}

Response

HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "weight": 10,
    "jobs": [],
    "minimum_agents": null,
    "priority": 5,
    "name": "Test Queue",
    "maximum_agents": null,
    "id": 1,
    "parent": null,
    "parent_jobqueue_id": null
}
Statuscode 201:a new job queue was created
Statuscode 400:there was something wrong with the request (such as invalid columns being included)
Statuscode 409:a job queue with that name already exists
class pyfarm.master.api.jobqueues.SingleJobQueueAPI[source]

Bases: flask.views.MethodView

delete(queue_rq)[source]

A DELETE to this endpoint will delete the specified job queue

DELETE /api/v1/jobqueue/[<str:name>|<int:id>]

Request

DELETE /api/v1/jobqueues/Test%20Queue HTTP/1.1
Accept: application/json

Response

HTTP/1.1 204 NO_CONTENT
Statuscode 204:the job queue was deleted or didn’t exist
Statuscode 409:the job queue cannot be deleted because it still contains jobs or child queues
get(queue_rq)[source]

A GET to this endpoint will return the requested job queue

GET /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1

Request

GET /api/v1/jobqueues/Test%20Queue HTTP/1.1
Accept: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 1,
    "parent": [],
    "jobs": [],
    "weight": 10,
    "parent_jobqueue_id": null,
    "priority": 5,
    "minimum_agents": null,
    "name": "Test Queue",
    "maximum_agents": null
}
Statuscode 200:no error
Statuscode 404:the requested job queue was not found
methods = ['DELETE', 'GET', 'POST']
post(queue_rq)[source]

A POST to this endpoint will update the specified queue with the data in the request. Columns not specified in the request will be left as they are.

POST /api/v1/jobqueues/[<str:name>|<int:id>] HTTP/1.1

Request

POST /api/v1/jobqueues/Test%20Queue HTTP/1.1
Accept: application/json

{
    "priority": 6
}

Response

HTTP/1.1 201 OK
Content-Type: application/json

{
    "id": 1,
    "parent": [],
    "jobs": [],
    "weight": 10,
    "parent_jobqueue_id": null,
    "priority": 6,
    "minimum_agents": null,
    "name": "Test Queue",
    "maximum_agents": null
}
Statuscode 200:the job queue was updated
Statuscode 400:there was something wrong with the request (such as invalid columns being included)
pyfarm.master.api.jobqueues.schema()[source]

Returns the basic schema of JobQueue

GET /api/v1/jobqueues/schema HTTP/1.1

Request

GET /api/v1/jobqueues/schema HTTP/1.1
Accept: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": "INTEGER",
    "name": VARCHAR(255)",
    "minimum_agents": "INTEGER",
    "maximum_agents": "INTEGER",
    "priority": "INTEGER",
    "weight": "INTEGER",
    "parent_jobqueue_id": "INTEGER"
}
Statuscode 200:no error