2018-12-20

提供cluster service 按条件查询cluster 信息

/api/v1/clusters GET

参数 名state 值为 QUEUED,CREATED,STARTING,RUNNING,ERROR,TERMINATED;

参数名为deployMode 值为 ON_DEMAND,ON_PREMISE,HYBRID

比如/api/cluster?state=QUEUED&deployMode =ON_PREMISE

返回json

[
    {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "deployMode": "onPremise",
        "clusterId": -1,
        "state": "running",
        "request": {
            "id": 737,
            "createdBy": 3,
            "updatedBy": 3,
            "createdAt": "2018-12-21T13:53:53.0594292+08:00",
            "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
            "name": "master",
            "computeNodeSpecs": [
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "compute",
                    "instanceType": "c4.large",
                    "count": 2
                }, 
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "master",
                    "instanceType": "c4.large",
                    "count": 1
                }
            ]
        }
    }
]
提供cluster service 更新cluster 信息

/api/v1/clusters/{id} PUT

{id}替换成cluster的 id

请求json

 {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "deployMode": "onPremise",
        "masterIp": "127.0.0.1",
        "masterPublicIp": "127.0.0.1",
        "apiToken": "2213wqfdsgwy234234sfdsfsfsf",
        "clusterId": -1,
        "state": "running",
        "request": {
            "id": 737,
            "createdBy": 3,
            "updatedBy": 3,
            "createdAt": "2018-12-21T13:53:53.0594292+08:00",
            "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
            "name": "master",
            "computeNodeSpecs": [
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "compute",
                    "instanceType": "c4.large",
                    "count": 2
                }, 
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "master",
                    "instanceType": "c4.large",
                    "count": 1
                }
            ]
        }
  }
提供cluster service 或者 scheduler 创建cluster,scheduler用户信息

//目前先通过客户端自行创建用户。
/api/v1/users post

请求json

{
    "name": "cluster",
    "username": "这里最好拼接一个全局唯一的字符串,比如UUID",
    "email": "请用全局唯一的字符串拼接上@等等",
    "password": "大于6位"
}

返回json

{
   "id": 1,
   "name": "cluster",
   "username": "这里最好拼接一个全局唯一的字符串,比如UUID",
   "email": "请用全局唯一的字符串拼接上@等等",
}
提供cluster service 或者 scheduler 删除cluster,scheduler用户信息

//目前先通过客户端自行创建用户。
/api/v1/users/{id} delete
此处 {id}替换成 上面创建的用户id

提供scheduler 按条件 查询job信息

/api/v1/jobs get

参数
state, 值为 job

    UN_COMMITTED,
    COMMITTED,
    QUEUED,
    RUNNING,
    CANCELLED,
    COMPLETE,
    FAILED;

返回 json

[ {
    "id": 737,
    "createdBy": 3,
    "updatedBy": 3,
    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
    "appId": 609,
    "type":"RAW",
    "name": "fastone",
    "description": "desc",
    "priority": 1,
    "parentId": 2,
    "inputs": [
        {
          "id": 737,
          "createdBy": 3,
          "updatedBy": 3,
          "createdAt": "2018-12-21T13:53:53.0594292+08:00",
          "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
          "type": "File",
          "description": "receptors file",
          "name": "receptors",
          "required": true,
          "value": "/fastone/vina-input/pro.pdb",
          "displayValue": "vina data set/pro.pdb"
        }
    ],
    "options":[
        {
             "id": 737,
             "createdBy": 3,
             "updatedBy": 3,
             "createdAt": "2018-12-21T13:53:53.0594292+08:00",
             "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
             "vcpu": "1",
             "memory":"13232323232",
             "priority": 1,
             "logLevel": "debug",
             "subTaskErrorStop": true
        }
    ],
    "command": ["cwl-runner", "--local", "--api=containers", "--disable-reuse", "--verbose", "--priority", "1", "--on-error", "continue", "--trash-intermediate", "/var/lib/cwl/workflow.json#main", "/var/lib/cwl/cwl.input.json"],
    "containerImage": "fastone/jobs",
    "state": "COMPLETE",
    "lockedBy": null,
    "output": {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "output": "/test/output",
        "log": "/test/log",
        "exitCode": 0
    },
        "finishedAt": "2018-12-21T13:53:53.0594292+08:00",
    "startedAt": "2018-12-21T13:53:53.0594292+08:00",

    "cluster": {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "deployMode": "ON_PREMISE",
        "clusterId": -1,
        "state": "RUNNING",
        "request": {
            "id": 737,
            "createdBy": 3,
            "updatedBy": 3,
            "createdAt": "2018-12-21T13:53:53.0594292+08:00",
            "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
            "name": "master",
            "computeNodeSpecs": [
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "COMPUTE",
                    "instanceType": "c4.large",
                    "count": 2
                }, 
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "MASTER",
                    "instanceType": "c4.large",
                    "count": 1
                }
            ]
        }
    }
 }
提供 job id查询job信息

/api/v1/job/{id} get

返回 json

{
    "id": 737,
    "createdBy": 3,
    "updatedBy": 3,
    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
    "appId": 609,
    "type":"RAW",
    "name": "fastone",
    "description": "desc",
    "priority": 1,
    "parentId": 2,
    "inputs": [
        {
          "id": 737,
          "createdBy": 3,
          "updatedBy": 3,
          "createdAt": "2018-12-21T13:53:53.0594292+08:00",
          "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
          "type": "File",
          "description": "receptors file",
          "name": "receptors",
          "required": true,
          "value": "/fastone/vina-input/pro.pdb",
          "displayValue": "vina data set/pro.pdb"
        }
    ],
    "options":[
        {
             "id": 737,
             "createdBy": 3,
             "updatedBy": 3,
             "createdAt": "2018-12-21T13:53:53.0594292+08:00",
             "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
             "vcpu": "1",
             "memory":"13232323232",
             "priority": 1,
             "logLevel": "debug",
             "subTaskErrorStop": true
        }
    ],
    "command": ["cwl-runner", "--local", "--api=containers", "--disable-reuse", "--verbose", "--priority", "1", "--on-error", "continue", "--trash-intermediate", "/var/lib/cwl/workflow.json#main", "/var/lib/cwl/cwl.input.json"],
    "containerImage": "fastone/jobs",
    "state": "COMPLETE",
    "lockedBy": null,
    "output": {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "output": "/test/output",
        "log": "/test/log",
        "exitCode": 0
    },
        "finishedAt": "2018-12-21T13:53:53.0594292+08:00",
    "startedAt": "2018-12-21T13:53:53.0594292+08:00",

    "cluster": {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "deployMode": "ON_PREMISE",
        "clusterId": -1,
        "state": "RUNNING",
        "request": {
            "id": 737,
            "createdBy": 3,
            "updatedBy": 3,
            "createdAt": "2018-12-21T13:53:53.0594292+08:00",
            "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
            "name": "master",
            "computeNodeSpecs": [
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "COMPUTE",
                    "instanceType": "c4.large",
                    "count": 2
                }, 
                {
                    "id": 737,
                    "createdBy": 3,
                    "updatedBy": 3,
                    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
                    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
                    "role": "MASTER",
                    "instanceType": "c4.large",
                    "count": 1
                }
            ]
        }
    }
 }
提供scheduler 按条件 更新job信息

/api/v1/jobs PUT

请求 json

 {
    "id": 737,
    "parentId": 2,
    "containerImage": "fastone/jobs",
    "state": "COMPLETE",
    "lockedBy": null,
    "output": {
        "id": 737,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T13:53:53.0594292+08:00",
        "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
        "output": "/test/output",
        "log": "/test/log",
        "exitCode": 0
    },
    "finishedAt": "2018-12-21T13:53:53.0594292+08:00",
    "startedAt": "2018-12-21T13:53:53.0594292+08:00",
 }
提供scheduler 锁 job

/api/v1/job/lock/{id} PUT

{id} 替换成 job(父亲)的id

提供scheduler 解放锁 job

/api/v1/job/unlock/{id} PUT

{id} 替换成 job(父亲)的id

创建
app json

       {
        "id": 609,
        "createdBy": 3,
        "updatedBy": 3,
        "createdAt": "2018-12-21T10:55:28.651035+08:00",
        "updatedAt": "2018-12-21T10:55:28.651035+08:00",
        "name": "vina",
        "description": "desc",
        "definition": "创建app 时 定义文件的json格式",
        "inputs": [
            {
                "id": 705,
                "createdBy": 3,
                "updatedBy": 3,
                "createdAt": "2018-12-21T13:39:23.010261+08:00",
                "updatedAt": "2018-12-21T13:39:23.010261+08:00",
                "type": "File",
                "description": "receptors file",
                "name": "receptors",
                "required": true
            }
        ]
    }

folder json

{
    "id": 737,
    "createdBy": 3,
    "updatedBy": 3,
    "createdAt": "2018-12-21T13:53:53.0594292+08:00",
    "updatedAt": "2018-12-21T13:53:53.0594292+08:00",
    "name": "文件夹名称",
    "description": "desc",
    "fileNumber": 10,
    "path": "/test"
}

你可能感兴趣的:(2018-12-20)