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

FieldTypeDescription
inputobjectTest input; an empty object is used when omitted.
wait_timeout_secondsintegerNumber 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
      }
    }
  }
}
FieldTypeDescription
codestringOK on success.
msgstringOK on success.
data.test_run.operator_idintegerCustom operator ID for this test.
data.test_run.node_idstringThe operator ID used in this test.
data.test_run.versionstringThe operator version used in this test.
data.test_run.task_idstringID of this test task.
data.test_run.case_idstringID of this test record.
data.test_run.statusstringTest running status.
data.test_run.case_resultstringTest case result; returned if there is a value.
data.test_run.runtime_inputobjectActual input; returned if there is a value.
data.test_run.runtime_outputobjectActual output; returned if there is a value.
data.test_run.case_errorstringTest error message; returned when there is an error.
data.test_run.node_detailobjectDetails of the execution node of the operator in this test; returned if there is a value.
data.test_run.node_detail.node.flow_idstringThe process to which the execution node belongs.
data.test_run.node_detail.node.namestringExecution node name.
data.test_run.node_detail.node.node_keystringExecution node ID.
data.test_run.node_detail.node.node_typestringExecution node type.
data.test_run.node_detail.node.display_namestringExecution node display name.
data.test_run.node_detail.node.workitem_idstringWork item ID; returned if there is a value.
data.test_run.node_detail.node.node_execution_idstringNode execution identifier; returned if there is a value.
data.test_run.node_detail.run.statusstringNode execution status.
data.test_run.node_detail.run.started_atstringStart time; returned if there is a value.
data.test_run.node_detail.run.ended_atstringEnd time; returned if there is a value.
data.test_run.node_detail.run.errorstringExecution error; returned if there is a value.
data.test_run.node_detail.run.duration_msintegerNode execution time, unit is milliseconds; returned if there is a value.
data.test_run.node_detail.run.runtime_inputobjectThe actual input of the node.
data.test_run.node_detail.run.runtime_outputobjectThe actual output of the node.
data.test_run.node_detail.run.configobjectNode configuration.
data.test_run.node_detail.run.runtime_varsobjectNode running variable; returned when there is a value.
data.test_run.node_detail.run.metricsobjectNode running indicator; returned if there is a value.
data.test_run.node_detail.run.developer_logsobjectNode development log; returned if there is a value.
data.test_run.developer_logsobjectDevelopment log; returned when the service is provided.
data.test_run.wait_timeout_secondsintegerThe number of seconds to wait for the result of this test.

Error response

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}
FieldTypeDescription
codestringError code.
msgstringReadable error message.
datanull`null` in an error response.

Follow-up operations

After completion Query custom operator details confirms the current status.

Last updated on