pyfarm.master.api.software module

Software

Contained within this module are an API handling functions which can manage or query software items using JSON.

class pyfarm.master.api.software.SingleSoftwareAPI[source]

Bases: flask.views.MethodView

delete(software_rq)[source]

A DELETE to this endpoint will delete the requested software tag

DELETE /api/v1/software/<str:softwarename> HTTP/1.1

Request

DELETE /api/v1/software/Autodesk%20Maya HTTP/1.1
Accept: application/json

Response

HTTP/1.1 204 NO_CONTENT
Statuscode 204:the software tag was deleted or didn’t exist
get(software_rq)[source]

A GET to this endpoint will return the requested software tag

GET /api/v1/software/<str:softwarename> HTTP/1.1

Request

GET /api/v1/software/Autodesk%20Maya HTTP/1.1
Accept: application/json

Response

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

{
    "software": "Autodesk Maya",
    "id": 1,
    "versions": [
        {
            "version": "2013",
            "id": 1,
            "rank": 100
        },
        {
            "version": "2014",
            "id": 2,
            "rank": 200
        }
    ]
}
Statuscode 200:no error
Statuscode 404:the requested software tag was not found
methods = ['DELETE', 'GET', 'PUT']
put(software_rq)[source]

A PUT to this endpoint will create a new software tag under the given URI or update an existing software tag if one exists. Renaming existing software tags via this call is supported, but when creating new ones, the included software name must be equal to the one in the URI.

You should only call this by id for overwriting an existing software tag or if you have a reserved software id. There is currently no way to reserve a tag id.

PUT /api/v1/software/<str:softwarename> HTTP/1.1

Request

PUT /api/v1/software/blender HTTP/1.1
Accept: application/json

{
    "software": "blender"
}

Response

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

{
    "id": 4,
    "software": "blender",
    "versions": []
}

Request

PUT /api/v1/software/blender HTTP/1.1
Accept: application/json

{
    "software": "blender",
    "version": [
        {
            "version": "1.69"
        }
    ]
}

Response

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

{
    "id": 4,
    "software": "blender",
    "versions": [
        {
            "version": "1.69",
            "id": 1,
            "rank": 100
        }
    ]
}
Statuscode 200:an existing software tag was updated
Statuscode 201:a new software tag was created
Statuscode 400:there was something wrong with the request (such as invalid columns being included)
class pyfarm.master.api.software.SingleSoftwareVersionAPI[source]

Bases: flask.views.MethodView

delete(software_rq, version_name)[source]

A DELETE to this endpoint will delete the requested software version

DELETE /api/v1/software/<str:softwarename>/versions/<str:version> HTTP/1.1

Request

DELETE /api/v1/software/Autodesk%20Maya/versions/2013 HTTP/1.1
Accept: application/json

Response

HTTP/1.1 204 NO_CONTENT
Statuscode 204:the software version was deleted or didn’t exist
Statuscode 404:the software specified does not exist
get(software_rq, version_name)[source]

A GET to this endpoint will return the specified version

GET /api/v1/software/<str:softwarename>/versions/<str:version> HTTP/1.1

Request

GET /api/v1/software/Autodesk%20Maya/versions/2014 HTTP/1.1
Accept: application/json

Response

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

{
    "version": "2013",
    "id": 1,
    "rank": 100,
    "discovery_function_name": null
}
Statuscode 200:no error
Statuscode 404:the requested software tag or version was not found
methods = ['DELETE', 'GET']
class pyfarm.master.api.software.SoftwareIndexAPI[source]

Bases: flask.views.MethodView

get()[source]

A GET to this endpoint will return a list of known software, with all known versions.

GET /api/v1/software/ HTTP/1.1

Request

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

Response

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

[
    {
        "software": "Houdini",
        "id": 1,
        "versions": [
            {
                "version": "13.0.1",
                "id": 1,
                "rank": 100
            }
        ]
    }
]
Statuscode 200:no error
methods = ['GET', 'POST']
post()[source]

A POST to this endpoint will create a new software tag.

A list of versions can be included. If the software item already exists the listed versions will be added to the existing ones. Versions with no explicit rank are assumed to be the newest version available. Users should not mix versions with an explicit rank with versions without one.

POST /api/v1/software/ HTTP/1.1

Request

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

{
    "software": "blender"
}

Response (new software item create)

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

{
    "id": 4,
    "software": "blender",
    "versions": []
}
Statuscode 201:a new software item was created
Statuscode 400:there was something wrong with the request (such as invalid columns being included)
Statuscode 409:a software tag with that name already exists
class pyfarm.master.api.software.SoftwareVersionDiscoveryCodeAPI[source]

Bases: flask.views.MethodView

get(software_rq, version_name)[source]

A GET to this endpoint will return just the python code for detecting whether this software version is installed on an agent.

GET /api/v1/software/[<str:software_name>|<int:software_id>]/versions/<str:version>/code HTTP/1.1

Request

GET /api/v1/software/Blender/versions/2.72/code HTTP/1.1
Accept: text/x-python

Response

HTTP/1.1 200 OK
Content-Type: text/x-python

def blender_2_72_installed()
    return True
Statuscode 200:no error
Statuscode 404:software or version not found or this software version has no discovery code defined
methods = ['GET']
class pyfarm.master.api.software.SoftwareVersionsIndexAPI[source]

Bases: flask.views.MethodView

get(software_rq)[source]

A GET to this endpoint will list all known versions for this software

GET /api/v1/software/<str:softwarename>/versions/ HTTP/1.1

Request

GET /api/v1/software/Autodesk%20Maya/versions/ HTTP/1.1
Accept: application/json

Response

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

[
    {
        "version": "2013",
        "id": 1,
        "rank": 100
    },
    {
        "version": "2014",
        "id": 2,
        "rank": 200
    }
]
Statuscode 200:no error
Statuscode 404:the requested software tag was not found
methods = ['GET', 'POST']
post(software_rq)[source]

A POST to this endpoint will create a new version for this software.

A rank can optionally be included. If it isn’t, it is assumed that this is the newest version for this software

POST /api/v1/software/versions/ HTTP/1.1

Request

POST /api/v1/software/blender/versions/ HTTP/1.1
Accept: application/json

{
    "version": "1.70"
}

Response

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

{
    "id": 4,
    "version": "1.70",
    "rank": "100"
}
Statuscode 201:a new software version was created
Statuscode 400:there was something wrong with the request (such as invalid columns being included)
Statuscode 409:a software version with that name already exists
exception pyfarm.master.api.software.VersionParseError[source]

Bases: Exception

Raised by extract_version_dicts() when the function is unable to parse a version.

pyfarm.master.api.software.extract_version_dicts(json_in)[source]

Extracts and returns a list of versions from json_in.

pyfarm.master.api.software.schema()[source]

Returns the basic schema of Software

GET /api/v1/software/schema HTTP/1.1

Request

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

Response

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

{
    "id": "INTEGER",
    "software": "VARCHAR(64)"
}
Statuscode 200:no error