Skip to content
Shashank Sahni edited this page Oct 25, 2013 · 18 revisions

Description for Rest API of v0.1.0 Note: Cluster API has been removed for the time being.

Job Object

{
    job:{
        name:"my-job",
        jar: s3://mybucket/file_mapred.jar,
        args: "class_name arg1 arg2"
        deadline: "15/06/2013",
        input: "s3://bucket or swift://container",
        output: "s3://bucket or swift://container",
        master:{
            flavor: m1.medium,
        },
        slaves:[
            {
            flavor: "m1.large",
            instances:2,
            },
            {
            flavor: "m1.small",
            instances:1,
            }
        ]
        }
}

Cluster Object

{
    cluster:{
        name:"test"
        master:{
        flavor: "m1.medium"
        },
        slaves:[
            {
            flavor: "m1.large",
            instances:2,
            },
            {
            flavor: "m1.small",
            instances:1,
            }
        ],
        image-id: "ubuntu-12.04-amd64.img",
        nodes: [
             <node_object>,
             <node_object>,
             <node_object>,
             <node_object>
        ]
}

Node Object

node: {
    id: i-000007e7,
    private_ip_address: 172.17.12.11
}

API Operations

List all Clusters

GET /v0.1/clusters

Request

GET http://hs/v0.1/clusters
Accept: application/json

Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: XX
clusters:[{
        name:"test"
        master:{
        flavor: "m1.medium"
        instances: 1
        }
        slaves:[
            {
            flavor: "m1.large"
            instances:2
            },
            {
            flavor: "m1.small"
            instances:1
            }
        ]
        image-id: "ubuntu-12.04-amd64.img"
        },
        cluster:{
        name:"test2"
        master:{
        flavor: "m1.medium"
        instances: 1
        }
        slaves:[
            {
            flavor: "m1.large"
            instances:3
            },
            {
            flavor: "m1.small"
            instances:2
            }
        ]
        image-id: "ubuntu-12.04-amd64.img"
        }]

Create a Cluster

POST /v0.1/clusters

Request

POST http://hs/v0.1/clusters
{
    cluster:{
        name:"test"
        master:{
        flavor: "m1.medium"
        instances: 1
        }
        slaves:[
            {
            flavor: "m1.large"
            instances:2
            }
        ]
        image-id: "ubuntu-12.04-amd64.img"
        }
}

Response

HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: XX
{
    cluster:{
        name:"test",
        master:{
        flavor: "m1.medium"
        instances: 1
        },
        slaves:[
            {
            flavor: "m1.large"
            instances:2
            }
        ],
        image-id: "ubuntu-12.04-amd64.img",
        status: "creating"
        }
}

Scale a cluster up or down

Request

Add 2 m1.large instances.

POST http://hs/v0.1/clusters/<cluster_id>/add
{
    slaves:[
        {
        flavor: "m1.large"
        instances:2
        }
    ]
}

Response

HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: XX
{
    cluster:{
        id: "abcd123",
        name:"test",
        master:{
        flavor: "m1.medium"
        instances: 1
        },
        slaves:[
            {
            flavor: "m1.small"
            instances:2
            },
            {
            flavor: "m1.large"
            instances:2
            }
        ],
        image-id: "ubuntu-12.04-amd64.img",
        status: "creating"
        }
}

Remove one m1.large instance

Request

POST http://hs/v0.1/clusters/<cluster_id>/rm
{
    slaves:[
        {
        flavor: "m1.large"
        instances:1
        }
    ]
}

Response

HTTP/1.1 202 Accepted
Content-Type: application/json
Content-Length: XX
{
    cluster:{
        id: "abcd123",
        name:"test",
        master:{
        flavor: "m1.medium"
        instances: 1
        },
        slaves:[
            {
            flavor: "m1.small"
            instances:2
            },
            {
            flavor: "m1.large"
            instances:1
            }
        ],
        image-id: "ubuntu-12.04-amd64.img",
        status: "creating"
        }
}
Clone this wiki locally
You can’t perform that action at this time.