Test-run custom operator¶
Execute a custom operator test using the given input and return the test record. Only enabled Python code type operators can be piloted.
HTTP
POST $CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID/test-run
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query custom operator details and confirm that the operator to be tested is enabled and is a Python code type.
Request¶
Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID/test-run" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"input": {
"text": "OmniFabric"
},
"wait_timeout_seconds": 30
}'
Request body
| Field | Type | Description |
|---|---|---|
input | object | Test input; an empty object is used when omitted. |
wait_timeout_seconds | integer | Number of seconds to wait for test results. |
Successful response¶
The response returns the test record. Check test status, output, and error messages to confirm that the operator is functioning as expected.
The response fields are as follows.
JSON
{
"code": "OK",
"msg": "OK",
"data": {
"test_run": {
"operator_id": 123,
"node_id": "moi:custom.operator:workspace:text_counter",
"version": "v1",
"task_id": "task_01",
"case_id": "case_01",
"status": "succeeded",
"runtime_input": {
"text": "OmniFabric"
},
"runtime_output": {
"count": 9
}
}
}
}
| Field | Type | Description |
|---|---|---|
code | string | OK on success. |
msg | string | OK on success. |
data.test_run.operator_id | integer | Custom operator ID for this test. |
data.test_run.node_id | string | The operator ID used in this test. |
data.test_run.version | string | The operator version used in this test. |
data.test_run.task_id | string | ID of this test task. |
data.test_run.case_id | string | ID of this test record. |
data.test_run.status | string | Test running status. |
data.test_run.case_result | string | Test case result; returned if there is a value. |
data.test_run.runtime_input | object | Actual input; returned if there is a value. |
data.test_run.runtime_output | object | Actual output; returned if there is a value. |
data.test_run.case_error | string | Test error message; returned when there is an error. |
data.test_run.node_detail | object | Details of the execution node of the operator in this test; returned if there is a value. |
data.test_run.node_detail.node.flow_id | string | The process to which the execution node belongs. |
data.test_run.node_detail.node.name | string | Execution node name. |
data.test_run.node_detail.node.node_key | string | Execution node ID. |
data.test_run.node_detail.node.node_type | string | Execution node type. |
data.test_run.node_detail.node.display_name | string | Execution node display name. |
data.test_run.node_detail.node.workitem_id | string | Work item ID; returned if there is a value. |
data.test_run.node_detail.node.node_execution_id | string | Node execution identifier; returned if there is a value. |
data.test_run.node_detail.run.status | string | Node execution status. |
data.test_run.node_detail.run.started_at | string | Start time; returned if there is a value. |
data.test_run.node_detail.run.ended_at | string | End time; returned if there is a value. |
data.test_run.node_detail.run.error | string | Execution error; returned if there is a value. |
data.test_run.node_detail.run.duration_ms | integer | Node execution time, unit is milliseconds; returned if there is a value. |
data.test_run.node_detail.run.runtime_input | object | The actual input of the node. |
data.test_run.node_detail.run.runtime_output | object | The actual output of the node. |
data.test_run.node_detail.run.config | object | Node configuration. |
data.test_run.node_detail.run.runtime_vars | object | Node running variable; returned when there is a value. |
data.test_run.node_detail.run.metrics | object | Node running indicator; returned if there is a value. |
data.test_run.node_detail.run.developer_logs | object | Node development log; returned if there is a value. |
data.test_run.developer_logs | object | Development log; returned when the service is provided. |
data.test_run.wait_timeout_seconds | integer | The number of seconds to wait for the result of this test. |
Error response¶
JSON
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
| Field | Type | Description |
|---|---|---|
code | string | Error code. |
msg | string | Readable error message. |
data | null | `null` in an error response. |
Follow-up operations¶
After completion Query custom operator details confirms the current status.
Last updated on