Script Development / Connector Object DFF.CONN / DataFlux Func Sidecar
Using the Sidecar Connector operation object allows users to call Sidecar to execute Shell commands.
The DFF.CONN(...) parameters are as follows:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
connector_id |
str | Required | Connector ID |
timeout |
int/float | 10 |
Default HTTP request timeout for the current operation object, in seconds |
Sidecar Guide
For complete usage instructions for Sidecar, please refer to the Sidecar Guide
.shell(...)
Execute a Sidecar call to run Shell commands. The parameters are as follows:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
cmd |
str | Required | Shell command to execute e.g., "ls -l" |
wait |
bool | True |
Whether to wait for execution to complete When set to False, this function returns immediately and does not return terminal output |
workdir |
str | None |
Working directory for Shell command execution e.g., "/home/dev" |
envs |
dict | None |
Environment variables; both keys and values are strings e.g., {"MY_NAME": "Tom"} |
callback_url |
str | None |
Callback URL; after the command executes, stdout and stderr are sent to the specified URL via POSTUsually used together with wait=False to implement asynchronous callbacks |
timeout |
int/float | None |
Timeout for this request Note: This parameter is not the timeout for the Shell command, but rather the timeout for Func's request to Sidecar If omitted, the operation object's default value, i.e., 10 seconds, is used |
This method returns (status_code, result): status_code is the HTTP response status code from Sidecar, and result is the parsed response content. An exception is thrown when the HTTP status code is greater than or equal to 400.
.call(...)
Send an HTTP request with the Connector signature to Sidecar. The parameters are as follows:
| Parameter | Type | Required / Default | Description |
|---|---|---|---|
method |
str | Required | HTTP request method; can also be written as "GET /path" |
path |
str | None |
Request path starting with /; if omitted, it is extracted from method |
query |
dict | None |
URL query parameters |
body |
- | None |
Request body; non-string values are serialized to JSON first |
timeout |
int/float | None |
Timeout for this request; if omitted, the operation object's default value is used |
The return value is the same as .shell(...).
Callback After Execution
After calling SidecarHelper.shell(...) and specifying the callback_url parameter, Sidecar will send the standard output stdout and standard error stderr to this address via POST after executing the Shell command.
The specific structure is as follows:
| Text Only | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
This structure matches the standard POST method of DataFlux Func's Func API, so you can directly use the Func API to receive callbacks after execution