Script Development / Built-in Variables _DFF_XXX
To facilitate the acquisition of relevant runtime status information during script execution, DataFlux Func directly incorporates some built-in variables in the script context that can be used immediately.
Built-in Variable | Type | Scope of Applicability | Description | Example Value |
---|---|---|---|---|
_DFF_SCRIPT_SET_ID |
str | All | Script Set ID | "demo" |
_DFF_SCRIPT_ID |
str | All | Script ID | "demo__basic" |
_DFF_FUNC_ID |
str | All | Function ID | "demo__basic.hello_world" |
_DFF_FUNC_NAME |
str | All | Function Name | "hello_world" |
_DFF_START_TIME |
int | All | Actual Start Time (seconds) | 1625651910 |
_DFF_START_TIME_MS |
int | All | Actual Start Time (milliseconds) | 1625651910630 |
_DFF_TRIGGER_TIME |
int | All | Scheduled Start Time (seconds) | 1625651909 |
_DFF_TRIGGER_TIME_MS |
int | All | Scheduled Start Time (milliseconds) | 1625651909582 |
_DFF_CRONTAB |
str | Timed Tasks (Old Version: Auto-trigger Configuration) | Crontab Expression | * * * * * |
_DFF_HTTP_REQUEST |
dict | Synchronous API (Old Version: Authorization Link), Asynchronous API (Old Version: Batch Processing) | Request Body when Interface is Called | See Below |
Difference Between _DFF_START_TIME
and _DFF_TRIGGER_TIME
_DFF_START_TIME
refers to the actual start time of the function, equivalent to executing int(time.time())
at the function entry point, which may be delayed due to queue congestion.
On the other hand, _DFF_TRIGGER_TIME
refers to the function trigger time, which does not change due to queue congestion. It can be considered as the "scheduled start time" with values as follows:
Function Invocation Method | Value |
---|---|
UI Executes Function | Time when the Backend API Service receives the HTTP request |
Synchronous API (Old Version: Authorization Link) | Time when the Backend API Service receives the HTTP request |
Asynchronous API (Old Version: Batch Processing) | Time when the Backend API Service receives the HTTP request |
Timed Task (Old Version: Auto-trigger Configuration) | The exact time corresponding to the Crontab expression |
When using timed tasks (Old Version: Auto-trigger Configuration) to fetch time-series data at fixed intervals, you should use _DFF_TRIGGER_TIME
and _DFF_TRIGGER_TIME_MS
as the reference. Do not use time.time()
within your code to get the current time.
_DFF_HTTP_REQUEST
Data Structure
The content of _DFF_HTTP_REQUEST
is the detailed request body.
If there is the following request:
Request Example | |
---|---|
1 2 3 4 5 |
|
Then, the value of _DFF_HTTP_REQUEST
is as follows:
_DFF_HTTP_REQUEST Content Example | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
The fields included in _DFF_HTTP_REQUEST
may vary slightly across different versions of DataFlux Func. Please refer to the actual content.
The type of the headers
field is IgnoreCaseDict data. IgnoreCaseDict inherits from dict, has similar usage but does not distinguish between upper and lower case key names, such as the following lines of code all return the same value
Python | |
---|---|
1 2 3 |
|