<dataprocessingJobs_uri>/copydata[.<format>]
copyData 资源表示拷贝数据作业根资源,列出所有可用的拷贝数据作业资源。
支持的方法:
支持的表述格式:RJSON、JSON、HTML、XML。
对如下 URI 执行 HTTP 请求,以 rjson 输出格式为例加以说明,其中,supermapiserver 是服务器名。
http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.rjson
获取拷贝数据作业列表
对 copyData 资源执行 GET 请求,在响应消息的实体主体里是一个拷贝数据资源描述集,其中单个资源描述的结构如下:
字段 | 类型 | 说明 |
id | String | 应用ID。 |
state | SparkJobState | 该任务的状态。包括执行状态、起止时间、耗时等。 |
setting | SparkJobSetting | 列举了任务配置的详细信息。 |
对 copyData 资源执行 GET 请求,返回 rjson 格式的资源描述如下:
[
{
"id": "c5da4059_e6e2_4e0e_a34e_09ca4df62d72",
"state": {
"errorStackTrace": null,
"endState": true,
"startTime": 1544423610986,
"endTime": 1544423686309,
"publisherelapsedTime": 0,
"runState": "FINISHED",
"errorMsg": null,
"elapsedTime": 72688
},
"setting": {
"output": {
"outputPath": null,
"datasetName": "analystResult",
"datasourceInfo": {
"dataBase": "iserver021",
"server": "192.168.120.21:2181",
"password": null,
"driver": null,
"openLinkTable": false,
"alias": null,
"engineType": "HBASE",
"exclusive": false,
"readOnly": false,
"user": null,
"connect": false
},
"type": "HBASE"
},
"args": null,
"input": {
"datasetNames": [
"samples_processing_newyorkZone_R",
"samples_processing_singleRegion_R",
"samples_processing_newyorkRoads_L"
],
"datasetIndexSettings": [
{
"datasetName": "samples_processing_newyorkZone_R",
"buildPyramid": false,
"indexFieldNames": [
"Shape_Area"
]
},
{
"datasetName": "samples_processing_singleRegion_R",
"buildPyramid": true,
"indexFieldNames": [
"SmUserID",
"SmArea"
]
},
{
"datasetName": "samples_processing_newyorkRoads_L",
"buildPyramid": true,
"indexFieldNames": [
"name",
"type"
]
}
]
},
"DEFAULT_MASTER_ADRESS": "local[*] ",
"referToken": "6Ut0ie-7OxwqW8UGDworIUS1tGgTPJ1iHQTpjs0XiAsY9iNOk2vu1BghOyBdszaYyC0A3hjIbzyEStl1nUMvKg..",
"mainClass": null,
"sparkLogFile": null,
"appName": null,
"contextSetting": null,
"serviceInfo": {
"targetDataPath": null,
"targetServiceInfos": null
},
"referServicesAddress": "http://localhost:8090/iserver"
}
},
{
"id": "b5201533_8c54_4803_a3e2_426f190b64a9",
"state": {
"errorStackTrace": null,
"endState": true,
"startTime": 1544424266266,
"endTime": 1544424283154,
"publisherelapsedTime": 0,
"runState": "FINISHED",
"errorMsg": null,
"elapsedTime": 15202
},
"setting": {
"output": {
"outputPath": null,
"datasetName": "analystResult",
"datasourceInfo": {
"dataBase": "iserver020",
"server": "localhost:2181",
"password": "",
"driver": null,
"openLinkTable": false,
"alias": "hbase",
"engineType": "HBASE",
"exclusive": false,
"readOnly": false,
"user": "",
"connect": false
},
"type": "HBASE"
},
"args": null,
"input": {
"datasetNames": [
"newyorkZone_R"
],
"copyDataType": "UDB",
"dataPath": "F:\\01_package\\ProcessingData\\processing.udb"
},
"DEFAULT_MASTER_ADRESS": "local[*] ",
"referToken": "6Ut0ie-7OxwqW8UGDworIUS1tGgTPJ1iHQTpjs0XiAsY9iNOk2vu1BghOyBdszaYyC0A3hjIbzyEStl1nUMvKg..",
"mainClass": null,
"sparkLogFile": null,
"appName": null,
"contextSetting": null,
"serviceInfo": {
"targetDataPath": null,
"targetServiceInfos": null
},
"referServicesAddress": "http://localhost:8090/iserver"
}
}
]
创建一个拷贝数据任务
对 copyData 资源执行 POST 请求,创建一个拷贝数据任务,请求体需包含参数如下:
名称 | 类型 | 含义 |
input | CopyDatasetInputSetting | 支持以下输入参数且对数据集支持批量输入,其中包含以下字段:
|
CopyFileDataInputSetting |
|
|
output | DatabaseOutputSetting | 结果输出到自定义目标数据库或已注册允许编辑的目标数据库时,其中包含以下字段【必填参数】:
|
对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 以输入已注册的数据集,输出结果到自定义目标数据库形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:
{
"input": {
"datasetIndexSettings": [
{
"datasetName": "samples_processing_newyorkZone_R",
"buildPyramid": false,
"indexFieldNames": [
"Shape_Area"
]
},
{
"datasetName": "samples_processing_singleRegion_R",
"buildPyramid": true,
"indexFieldNames": [
"SmUserID",
"SmArea"
]
},
{
"datasetName": "samples_processing_newyorkRoads_L",
"buildPyramid": true,
"indexFieldNames": [
"name",
"type"
]
}
],
"datasetNames": [
"samples_processing_newyorkZone_R",
"samples_processing_singleRegion_R",
"samples_processing_newyorkRoads_L"
]
},
"output": {
"type": "HBASE",
"datasourceInfo": {
"dataBase": "iserver021",
"server": "localhost:2181",
"engineType": "HBASE"
}
}
}
返回 rjson 格式的操作结果表述如下:
{
"postResultType": "CreateChild",
"newResourceID": "2e6a9552_f956_4969_b56a_811060e86b09",
"succeed": true,
"newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/2e6a9552_f956_4969_b56a_811060e86b09"
}
对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 以输入数据集文件路径,输出结果到已注册允许编辑的目标数据库的形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:
{
"input": {
"datasetNames": [
"newyorkZone_R"
],
"dataPath": "F:\\data\\ProcessingData\\processing.udb",
"copyDataType": "UDB"
},
"output": {
"type": "HBASE",
"datasourceInfo": {
"dataBase": "iserver008",
"server": "192.168.120.91:2181",
"password": "",
"driver": null,
"openLinkTable": false,
"alias": "Hbase",
"engineType": "HBASE",
"exclusive": false,
"readOnly": false,
"user": "",
"connect": false
}
}
}
返回 rjson 格式的操作结果表述如下:
{
"postResultType": "CreateChild",
"newResourceID": "317cd0c8_d410_48cf_bdb1_f769f65d9959",
"succeed": true,
"newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/317cd0c8_d410_48cf_bdb1_f769f65d9959"
}
对示例 copyData 资源:http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata.json 批量拷贝数据集到自定义的目标数据库的形式执行POST 请求,创建一个拷贝数据任务。请求体中的参数如下:
{
"input": {
"dataPath": "F:\\01_package\\20180822\\ProcessingData\\processing.udb",
"copyDataType": "UDB"
},
"output": {
"type": "HBASE",
"datasourceInfo": {
"dataBase": "iserver010",
"server": "192.168.120.21:2181",
"engineType": "HBASE"
}
}
}
返回 rjson 格式的操作结果表述如下:
{
"postResultType": "CreateChild",
"newResourceID": "694405aa_d41c_4ecc_a057_60a072e1be94",
"succeed": true,
"newResourceLocation": "http://supermapiserver:8090/iserver/services/distributedanalyst/rest/v1/jobs/dataprocessing/copydata/694405aa_d41c_4ecc_a057_60a072e1be94"
}
返回跟 GET 请求一样的 HTTP 响应头,但是没有响应实体。可以在不必传输整个响应内容的情况下,获取包含在响应消息头中的元数据信息。元数据信息包括媒体类型,字符编码,压缩编码,实体内容长度等。
HEAD 请求可以用来判断 copyData 资源是否存在,或者客户端是否有权限访问 copyData 资源。通过对加.<format>的 URI 执行 HEAD 请求,还可以快速判断 copyData 资源是否支持<format>格式的表述。