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.
POST https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID/test-run
Preparation before calling¶
First query custom operator details and confirm that the operator to be tested is enabled and is a Python code type. Prepare the personal access token, target workspace ID, and custom operator ID that have access to the target workspace.
Request body¶
inputobject- Test input; an empty object is used when omitted.
wait_timeout_secondsinteger- Number of seconds to wait for test results.
Request example
curl -X POST "https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID/test-run" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"input": {
"text": "MatrixOne"
},
"wait_timeout_seconds": 30
}'
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.
codestring- OK on success.
msgstring- OK on success.
data.test_run.operator_idinteger- Custom operator ID for this test.
data.test_run.node_idstring- The operator ID used in this test.
data.test_run.versionstring- The operator version used in this test.
data.test_run.task_idstring- ID of this test task.
data.test_run.case_idstring- ID of this test record.
data.test_run.statusstring- Test running status.
data.test_run.case_resultstring- Test case result; returned if there is a value.
data.test_run.runtime_inputobject- Actual input; returned if there is a value.
data.test_run.runtime_outputobject- Actual output; returned if there is a value.
data.test_run.case_errorstring- Test error message; returned when there is an error.
data.test_run.node_detailobject- Details of the execution node of the operator in this test; returned if there is a value.
data.test_run.node_detail.node.flow_idstring- The process to which the execution node belongs.
data.test_run.node_detail.node.namestring- Execution node name.
data.test_run.node_detail.node.node_keystring- Execution node ID.
data.test_run.node_detail.node.node_typestring- Execution node type.
data.test_run.node_detail.node.display_namestring- Execution node display name.
data.test_run.node_detail.node.workitem_idstring- Work item ID; returned if there is a value.
data.test_run.node_detail.node.node_execution_idstring- Node execution identifier; returned if there is a value.
data.test_run.node_detail.run.statusstring- Node execution status.
data.test_run.node_detail.run.started_atstring- Start time; returned if there is a value.
data.test_run.node_detail.run.ended_atstring- End time; returned if there is a value.
data.test_run.node_detail.run.errorstring- Execution error; returned if there is a value.
data.test_run.node_detail.run.duration_msinteger- Node execution time, unit is milliseconds; returned if there is a value.
data.test_run.node_detail.run.runtime_inputobject- The actual input of the node.
data.test_run.node_detail.run.runtime_outputobject- The actual output of the node.
data.test_run.node_detail.run.configobject- Node configuration.
data.test_run.node_detail.run.runtime_varsobject- Node running variable; returned when there is a value.
data.test_run.node_detail.run.metricsobject- Node running indicator; returned if there is a value.
data.test_run.node_detail.run.developer_logsobject- Node development log; returned if there is a value.
data.test_run.developer_logsobject- Development log; returned when the service is provided.
data.test_run.wait_timeout_secondsinteger- The number of seconds to wait for the result of this test.
Successful response example
{
"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": "MatrixOne"
},
"runtime_output": {
"count": 9
}
}
}
}
Error response¶
codestring- Error code.
msgstring- Readable error message.
datanull- `null` in an error response.
Error response example
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
Follow-up operations¶
After completion Query custom operator details confirms the current status.
Last updated on