Test-run custom operator¶
Test-runs an enabled Python code type custom operator using the given input and returns the status, results, or errors of this run.
POST $CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/{operator_id}/test-run
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the custom operator list to obtain the custom operator ID. Then Query the custom operator details to confirm that the operator is enabled and is a Python code type. Prepare personal access token and target workspace ID that can access the target workspace.
Request body¶
Replace $CLOUDSIGMA_API_KEY, $WORKSPACE_ID, $OPERATOR_ID and test run inputs with actual values.
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
}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
integer |
Yes |
The custom operator ID to trial run, located in the request path. |
|
object |
No |
Test input. An empty object is used when omitted. |
|
integer |
No |
Number of seconds to wait for test results. When omitted or less than or equal to |
Successful response¶
{
"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": "completed",
"runtime_input": {
"text": "OmniFabric"
},
"runtime_output": {
"count": 10
}
}
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
success code. |
|
string |
Response information. |
|
object |
The data returned by this operation. |
|
object |
Trial run results. |
|
integer |
Custom operator ID for this trial run. |
|
string |
The operator ID in the workflow. |
|
string |
operator version. |
|
string |
Run task ID. |
|
string |
Run case ID. |
|
string |
This running status. The values are |
|
string |
Run result text. |
|
string |
Run error message. Returned if there is an error. |
|
object |
Node execution details. |
|
object |
Node information. |
|
string |
Process ID. |
|
string |
The name of the current object. |
|
string |
The full path of the node. |
|
string |
Node type. |
|
string |
Display name. |
|
string |
Work item ID. |
|
string |
Node execution ID. |
|
object |
Operational information. |
|
string |
status. |
|
string |
Start time. |
|
string |
end time. |
|
integer |
Time taken, in milliseconds. |
|
string |
error message. |
|
JSON value |
Run the input snapshot. |
|
JSON value |
Run output snapshot. |
|
JSON value |
Run variable snapshot. |
|
JSON value |
Configuration object. |
|
object |
Node indicators. |
|
string |
Enter. |
|
string |
output. |
|
string |
Scope or operating mode. |
|
string |
Model binding. |
|
string |
format. |
|
integer |
Chunk size. |
|
integer |
Number of rows affected. |
|
string |
Vector table configuration. |
|
object |
Development log. |
|
string |
Standard output log. |
|
string |
Standard error log. |
|
string |
Streaming information. |
|
integer |
Number of bytes of standard output. |
|
integer |
Number of standard error bytes. |
|
integer |
Number of bytes of stream output. |
|
string |
Actuator information. |
|
boolean |
Whether the output is limited. |
|
JSON value |
Actual running input. |
|
JSON value |
Run output. |
|
object |
Development log. |
|
string |
Standard output log. |
|
string |
Standard error log. |
|
string |
Streaming information. |
|
integer |
Number of bytes of standard output. |
|
integer |
Number of standard error bytes. |
|
integer |
Number of bytes of stream output. |
|
string |
Actuator information. |
|
boolean |
Whether the output is limited. |
|
integer |
The actual number of seconds to wait for results. |
Error response¶
A test run creates tasks and run records and starts execution. If the waiting result times out and returns 500 / ErrServer, the task may still continue to run and the timeout will not be automatically canceled. Check the existing running records first to avoid repeating the trial run directly.
{
"code": "ErrParamInvalid",
"msg": "请求参数无效"
}
Field |
Type |
Description |
|---|---|---|
|
string |
error code. |
|
string |
Readable error message. |
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Invalid request field, workspace, or operation precondition. |
Fix the request parameters and submit again. |
403 |
|
The current identity or active role does not have permission for this operation. |
Use an authorized identity or contact an administrator to grant access. |
404 |
|
The target object or required reference was not found. |
Verify the object identifier, workspace, and current status. |
500 |
|
Internal processing failed; write operations may have been partially applied. |
Retain request and trace details, and verify the current state before retrying. |
503 |
|
A business, runtime, or authorization dependency is temporarily unavailable. |
After the dependency recovers, check existing results first instead of blindly repeating writes. |