Get Job Details¶
获取数据读取任务或写入任务的详细信息。
前提条件¶
已存在数据读取任务或数据写入任务。
请求格式¶
GET https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/jobs/{jobId}
请求参数(Header)¶
名称 |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|
Content-Type |
必需 |
String |
内容或文件类型,默认值为 application/json。 |
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|---|
orgId |
Query |
必需 |
String |
用户所属的组织ID。如何获取orgId信息>> |
channelId |
Path |
必需 |
String |
通道ID。 |
jobId |
Path |
必需 |
String |
数据读取或数据写入任务ID。 |
响应参数¶
名称 |
数据类型 |
描述 |
---|---|---|
data |
List<JSONObject> |
返回任务详情,详见 任务信息结构体 |
任务信息结构体 ¶
名称 |
数据类型 |
描述 |
---|---|---|
jobId |
String |
任务ID。 |
sqlQuery |
String |
数据查询SQL语句。 |
state |
String |
任务状态。 |
totalFragments |
String |
任务总片段数。 |
finishedFragments |
String |
已完成片段。 |
startTime |
String |
任务开始时间。 |
endTime |
String |
任务结束时间。 |
示例¶
请求示例¶
url: https://{apigw-address}/data-federation/v2.0/channels/read/{channelId}/jobs/{jobId}?orgId={}
method: GET
返回示例¶
{
"msg": "OK",
"code": 0,
"data": {
"jobId": "2131ceb9-c00d-d42d-33db-c21002b97d16",
"totalFragments": 1,
"sqlQuery": "describe hive.db.test1",
"fragmentProfile": [
{
"minorFragmentProfile": [
{
"maxMemoryUsed": 6446336,
"minorFragmentId": 0,
"operatorProfile": [
{
"waitNanos": 0,
"setupNanos": 0,
"inputProfile": [
{
"batches": 2,
"records": 8,
"schemas": 1
}
],
"processNanos": 1096191,
"peakLocalMemoryAllocated": 2445568,
"operatorType": 30,
"operatorId": 4
},
{
"waitNanos": 0,
"setupNanos": 1982782,
"inputProfile": [
{
"batches": 1,
"records": 8,
"schemas": 1
}
],
"processNanos": 267596,
"peakLocalMemoryAllocated": 2441232,
"operatorType": 2,
"operatorId": 3
},
{
"waitNanos": 0,
"setupNanos": 54199,
"inputProfile": [
{
"batches": 1,
"records": 2,
"schemas": 1
}
],
"processNanos": 397197,
"peakLocalMemoryAllocated": 426072,
"operatorType": 14,
"operatorId": 2
},
{
"waitNanos": 0,
"setupNanos": 4057163,
"inputProfile": [
{
"batches": 1,
"records": 2,
"schemas": 1
}
],
"processNanos": 279497,
"peakLocalMemoryAllocated": 159744,
"operatorType": 10,
"operatorId": 1
},
{
"waitNanos": 328497,
"setupNanos": 0,
"metric": [
{
"metricId": 0,
"longValue": 78
}
],
"inputProfile": [
{
"batches": 1,
"records": 2,
"schemas": 1
}
],
"processNanos": 152199,
"peakLocalMemoryAllocated": 159744,
"operatorType": 13,
"operatorId": 0
}
],
"lastUpdate": 1590571335227,
"startTime": 1590571333875,
"state": 3,
"endTime": 1590571335225,
"lastProgress": 1590571335227,
"memoryUsed": 0
}
],
"majorFragmentId": 0
}
],
"startTime": 1590571333699,
"state": 2,
"endTime": 1590571335570,
"type": 1,
"planEnd": 1590571333795,
"queueWaitEnd": 1590571333862,
"user": "anonymous",
"finishedFragments": 0
}
}
Java SDK调用示例¶
import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envision.apim.poseidon.request.PoseidonRequest;
import com.google.common.net.HttpHeaders;
import org.apache.commons.codec.binary.Hex;
import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class Sample {
private static String accessKey = "AccessKey of your APP";
private static String secretKey = "SecretKey of your APP";
private static String orgId = "yourOrgId";
private static String chId = "yourChannelId";
private static String jobId = "yourJobId";
private static String url = "https://{domain_url}";
private static class Request extends PoseidonRequest {
public void setQueryParam(String key, Object value) {
queryEncodeParams().put(key, value);
}
public void setMethod(String method) {
this.method = method;
}
public void setBodyParams(String key, Object value) {
bodyParams().put(key, value);
}
private String method;
@Override
public String baseUri() {
return "";
}
@Override
public String method() {
return method;
}
}
@Test
public void getJobDetails() {
Request request = new Request();
request.setQueryParam("orgId", orgId);
request.setMethod("GET");
request.headerParams().put(HttpHeaders.CONTENT_TYPE, "application/json");
try {
JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey))
.url(url + "/data-federation/v2.0/channels/read/" + chId + "/jobs/" + jobId)
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}