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.

HTTP
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.

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
  }'

Parameter

Type

Required

Description

operator_id

integer

Yes

The custom operator ID to trial run, located in the request path.

input

object

No

Test input. An empty object is used when omitted.

wait_timeout_seconds

integer

No

Number of seconds to wait for test results. When omitted or less than or equal to 0, wait for 30 seconds, up to 120 seconds.

Successful response

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": "completed",
      "runtime_input": {
        "text": "OmniFabric"
      },
      "runtime_output": {
        "count": 10
      }
    }
  }
}

Field

Type

Description

code

string

success code.

msg

string

Response information.

data

object

The data returned by this operation.

data.test_run

object

Trial run results.

data.test_run.operator_id

integer

Custom operator ID for this trial run.

data.test_run.node_id

string

The operator ID in the workflow.

data.test_run.version

string

operator version.

data.test_run.task_id

string

Run task ID.

data.test_run.case_id

string

Run case ID.

data.test_run.status

string

This running status. The values are completed, failed, cancelled

data.test_run.case_result

string

Run result text.

data.test_run.case_error

string

Run error message. Returned if there is an error.

data.test_run.node_detail

object

Node execution details.

data.test_run.node_detail.node

object

Node information.

data.test_run.node_detail.node.flow_id

string

Process ID.

data.test_run.node_detail.node.name

string

The name of the current object.

data.test_run.node_detail.node.node_key

string

The full path of the node.

data.test_run.node_detail.node.node_type

string

Node type.

data.test_run.node_detail.node.display_name

string

Display name.

data.test_run.node_detail.node.workitem_id

string

Work item ID.

data.test_run.node_detail.node.node_execution_id

string

Node execution ID.

data.test_run.node_detail.run

object

Operational information.

data.test_run.node_detail.run.status

string

status.

data.test_run.node_detail.run.started_at

string

Start time.

data.test_run.node_detail.run.ended_at

string

end time.

data.test_run.node_detail.run.duration_ms

integer

Time taken, in milliseconds.

data.test_run.node_detail.run.error

string

error message.

data.test_run.node_detail.run.runtime_input

JSON value

Run the input snapshot.

data.test_run.node_detail.run.runtime_output

JSON value

Run output snapshot.

data.test_run.node_detail.run.runtime_vars

JSON value

Run variable snapshot.

data.test_run.node_detail.run.config

JSON value

Configuration object.

data.test_run.node_detail.run.metrics

object

Node indicators.

data.test_run.node_detail.run.metrics.input

string

Enter.

data.test_run.node_detail.run.metrics.output

string

output.

data.test_run.node_detail.run.metrics.mode

string

Scope or operating mode.

data.test_run.node_detail.run.metrics.model

string

Model binding.

data.test_run.node_detail.run.metrics.format

string

format.

data.test_run.node_detail.run.metrics.chunk_size

integer

Chunk size.

data.test_run.node_detail.run.metrics.affected_rows

integer

Number of rows affected.

data.test_run.node_detail.run.metrics.vector_table

string

Vector table configuration.

data.test_run.node_detail.run.developer_logs

object

Development log.

data.test_run.node_detail.run.developer_logs.stdout

string

Standard output log.

data.test_run.node_detail.run.developer_logs.stderr

string

Standard error log.

data.test_run.node_detail.run.developer_logs.stream

string

Streaming information.

data.test_run.node_detail.run.developer_logs.stdout_bytes

integer

Number of bytes of standard output.

data.test_run.node_detail.run.developer_logs.stderr_bytes

integer

Number of standard error bytes.

data.test_run.node_detail.run.developer_logs.stream_bytes

integer

Number of bytes of stream output.

data.test_run.node_detail.run.developer_logs.runner

string

Actuator information.

data.test_run.node_detail.run.developer_logs.output_limited

boolean

Whether the output is limited.

data.test_run.runtime_input

JSON value

Actual running input.

data.test_run.runtime_output

JSON value

Run output.

data.test_run.developer_logs

object

Development log.

data.test_run.developer_logs.stdout

string

Standard output log.

data.test_run.developer_logs.stderr

string

Standard error log.

data.test_run.developer_logs.stream

string

Streaming information.

data.test_run.developer_logs.stdout_bytes

integer

Number of bytes of standard output.

data.test_run.developer_logs.stderr_bytes

integer

Number of standard error bytes.

data.test_run.developer_logs.stream_bytes

integer

Number of bytes of stream output.

data.test_run.developer_logs.runner

string

Actuator information.

data.test_run.developer_logs.output_limited

boolean

Whether the output is limited.

data.test_run.wait_timeout_seconds

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.

JSON
{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效"
}

Field

Type

Description

code

string

error code.

msg

string

Readable error message.

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

ErrParamInvalid, ErrWorkspaceRequired

Invalid request field, workspace, or operation precondition.

Fix the request parameters and submit again.

403

ErrForbidden

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

ErrNotFound

The target object or required reference was not found.

Verify the object identifier, workspace, and current status.

500

ErrServer

Internal processing failed; write operations may have been partially applied.

Retain request and trace details, and verify the current state before retrying.

503

ErrServiceUnavailable

A business, runtime, or authorization dependency is temporarily unavailable.

After the dependency recovers, check existing results first instead of blindly repeating writes.

Last updated on