新建实时作业
功能介绍
除名称和描述外,可先不提供作业的详细配置信息。 check参数表示是否需要对作业配置进行检查:若为false,则不检查,将作业保存为草稿;若为true,则对作业配置进行检查,当检查不通过时,返回失败及错误信息,检查通过时,将作业状态修改为就绪,并返回成功。
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST /v1/{project_id}/streaming/jobs
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
项目ID 最小长度:1 最大长度:128 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
check |
否 |
Boolean |
是否需要校验配置是否正确 |
请求参数
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
X-Auth-Token |
是 |
String |
租户Token 最小长度:1 最大长度:65535 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
{自定义key} |
是 |
Object |
jobName:作业名称;jobDescription:作业描述;jobType:支持API、IDE、IOTDA_API类型;jobInputType:支持PIPELINE_DATA、ASSET_DATA类型。实时分析作业的详细配置。(实时分析作业详细配置,每个作业可选择不同的算子进行组合,各算子的使用方法详见:实时分析->作业开发->编排作业->表2:算子说明。) |
响应参数
状态码: 201
参数 |
参数类型 |
描述 |
---|---|---|
job_id |
String |
作业ID 最小长度:1 最大长度:100 |
check_info |
Map<String,Object> |
作业校验错误详情,若为空,则说明实时作业校验成功,否则,需要修改实时作业配置,校验成功(即该字段内容为空)后,才可启动。 |
状态码: 400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:1 最大长度:100 |
error_msg |
String |
错误消息 最小长度:0 最大长度:1024 |
状态码: 401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:1 最大长度:100 |
error_msg |
String |
错误消息 最小长度:0 最大长度:1024 |
状态码: 403
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:1 最大长度:100 |
error_msg |
String |
错误消息 最小长度:0 最大长度:1024 |
状态码: 500
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 最小长度:1 最大长度:100 |
error_msg |
String |
错误消息 最小长度:0 最大长度:1024 |
请求示例
{
"definition" : {
"jobName" : "pipeline_test",
"jobDescription" : "",
"jobType" : "IDE",
"jobInputType" : "PIPELINE_DATA"
},
"operatorInstances" : [ {
"id" : "operator1",
"className" : "PipelineSource",
"point" : {
"x" : 834,
"y" : 101
},
"configs" : {
"basicConfigs" : {
"name" : "管道数据输入"
}
}
}, {
"id" : "operator2",
"className" : "Filter",
"point" : {
"x" : 713,
"y" : 221
},
"fromOperators" : [ {
"id" : "operator1"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据过滤",
"conditionRelationship" : "AND",
"conditions" : [ {
"leftValue" : "",
"symbol" : "MORE_THAN",
"rightValue" : ""
} ]
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator3",
"className" : "Flat",
"point" : {
"x" : 717,
"y" : 301
},
"fromOperators" : [ {
"id" : "operator2"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据扁平",
"multiRecordsPath" : null,
"flatFieldConfig" : [ {
"field" : "",
"type" : "DOUBLE",
"path" : ""
} ]
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator4",
"className" : "Aggregate",
"point" : {
"x" : 736,
"y" : 394
},
"fromOperators" : [ {
"id" : "operator3"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据聚合",
"keyFields" : null,
"windowsType" : "TumblingTimeWindows",
"windowAssigner" : {
"timeType" : "ProcessingTime",
"size" : 10,
"slide" : 1,
"offset" : 0
},
"aggregateFields" : [ {
"field" : "",
"type" : "STRING",
"aggregateField" : "",
"aggregateType" : "SUM"
} ],
"eventConditions" : {
"eventOnCondition" : null,
"eventOffCondition" : null
}
},
"advanceConfigs" : {
"parallelism" : null,
"ttlTime" : null
}
}
}, {
"id" : "operator5",
"className" : "Map",
"point" : {
"x" : 738,
"y" : 477
},
"fromOperators" : [ {
"id" : "operator4"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据计算",
"mapFieldConfig" : [ {
"field" : "",
"type" : "STRING",
"expression" : ""
} ]
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator6",
"className" : "Aggregate",
"point" : {
"x" : 1115,
"y" : 365
},
"fromOperators" : [ {
"id" : "operator7"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据聚合",
"keyFields" : null,
"windowsType" : "TumblingTimeWindows",
"windowAssigner" : {
"timeType" : "ProcessingTime",
"size" : 10,
"slide" : 1,
"offset" : 0
},
"aggregateFields" : [ {
"field" : "",
"type" : "STRING",
"aggregateField" : "",
"aggregateType" : "SUM"
} ]
},
"advanceConfigs" : {
"parallelism" : null,
"ttlTime" : null
}
}
}, {
"id" : "operator7",
"className" : "Nest",
"point" : {
"x" : 1102,
"y" : 232
},
"fromOperators" : [ {
"id" : "operator1"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据嵌套",
"nestFieldConfig" : {
"field" : "",
"type" : "MAP",
"nestFields" : [ {
"path" : "",
"type" : "FIELD",
"value" : ""
} ]
}
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator8",
"className" : "Deduplicate",
"point" : {
"x" : 1093,
"y" : 471
},
"fromOperators" : [ {
"id" : "operator6"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据去重",
"keyFields" : null,
"relationship" : "AND",
"deduplicateFields" : ""
},
"advanceConfigs" : {
"parallelism" : null,
"deduplicatePeriod" : {
"isUseEventTime" : "TRUE",
"period" : null
},
"ttlTime" : null
}
}
}, {
"id" : "operator9",
"className" : "SelectFields",
"point" : {
"x" : 827,
"y" : 573
},
"fromOperators" : [ {
"id" : "operator5"
} ],
"configs" : {
"basicConfigs" : {
"name" : "数据选择",
"selectFields" : ""
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator10",
"className" : "DISSink",
"point" : {
"x" : 774,
"y" : 737
},
"fromOperators" : [ {
"id" : "operator9"
}, {
"id" : "operator8"
}, {
"id" : "operator12"
} ],
"configs" : {
"basicConfigs" : {
"name" : "DIS输出",
"dataSourceId" : ""
},
"advanceConfigs" : {
"parallelism" : null,
"partitioner" : null,
"format" : "JSON",
"csvSeparator" : null
}
}
}, {
"id" : "operator11",
"className" : "SMNSink",
"point" : {
"x" : 1096,
"y" : 717
},
"fromOperators" : [ {
"id" : "operator8"
} ],
"configs" : {
"basicConfigs" : {
"name" : "SMN输出",
"dataSourceId" : "",
"topicUrn" : "",
"messageSubject" : null,
"defaultMessage" : "",
"smsMessage" : null,
"emailMessage" : null,
"httpMessage" : null,
"httpsMessage" : null
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator12",
"className" : "CallFunctionGraph",
"point" : {
"x" : 571,
"y" : 577
},
"fromOperators" : [ {
"id" : "operator5"
} ],
"configs" : {
"basicConfigs" : {
"name" : "调用FunctionGraph云服务",
"dataSourceId" : "",
"apiParamFields" : "",
"apiOutputField" : {
"field" : "",
"type" : "STRING"
},
"apiResponseCode" : {
"field" : "",
"type" : "INTEGER"
}
},
"advanceConfigs" : {
"parallelism" : null
}
}
}, {
"id" : "operator13",
"className" : "SMNSink",
"point" : {
"x" : 397,
"y" : 713
},
"configs" : {
"basicConfigs" : {
"name" : "SMN输出",
"dataSourceId" : "",
"topicUrn" : "",
"messageSubject" : null,
"defaultMessage" : "",
"smsMessage" : null,
"emailMessage" : null,
"httpMessage" : null,
"httpsMessage" : null
},
"advanceConfigs" : {
"parallelism" : null
}
}
} ]
}
响应示例
状态码: 201
Created
{
"job_id" : "string",
"check_info" : { }
}
状态码
状态码 |
描述 |
---|---|
201 |
Created |
400 |
Bad Request |
401 |
Unauthorized |
403 |
Forbidden |
404 |
Not Found |
405 |
Method Not Allowed |
409 |
Conflict |
500 |
Internal Server Error |
错误码
请参见错误码。