Script Development / DataFlux Func Sidecar
Using the Sidecar Connector object allows users to invoke Sidecar to execute Shell commands.
DFF.CONN(...)
parameters are as follows:
Parameter | Type | Required / Default | Description |
---|---|---|---|
connector_id |
str | Required | Connector ID |
For the complete usage documentation of Sidecar, please refer to the 'Sidecar Guide'
.shell(...)
Invoke Sidecar to execute Shell commands, parameters are as follows:
Parameter | Type | Required / Default | Description |
---|---|---|---|
cmd |
str | Required | The Shell command to execute e.g., "ls -l" |
wait |
bool | True |
Whether to wait for the execution to complete When set to False , this function will return immediately and will not return the terminal output |
workdir |
str | None |
The working directory for the 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 is executed, the stdout and stderr will be sent to the specified URL via POSTGenerally used with the wait=False parameter to achieve asynchronous callback |
timeout |
int | 3 |
Request timeout Note: This parameter is not the timeout for the Shell command, but the timeout for the Func request to Sidecar i.e., the Func request to Sidecar may timeout, but the executed Shell command will not stop |
Post-execution Callback
After calling SidecarHelper.shell(...)
and specifying the callback_url
parameter, Sidecar will send the standard output stdout
and standard error stderr
to this URL 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 the DataFlux Func 'Func API' and can be directly used with the 'Func API' to receive the post-execution callback