-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #929 from lupko/master
RELATED: CQ-1005 - make FlexConnect function call deadline configurable
- Loading branch information
Showing
8 changed files
with
126 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# (C) 2024 GoodData Corporation | ||
import time | ||
from typing import Optional | ||
|
||
import pyarrow | ||
from gooddata_flexconnect.function.function import FlexConnectFunction | ||
from gooddata_flight_server import ArrowData | ||
|
||
_DATA: Optional[pyarrow.Table] = None | ||
|
||
|
||
class _LongRunningFun(FlexConnectFunction): | ||
Name = "LongRunningFun" | ||
Schema = pyarrow.schema( | ||
fields=[ | ||
pyarrow.field("col1", pyarrow.int64()), | ||
pyarrow.field("col2", pyarrow.string()), | ||
pyarrow.field("col3", pyarrow.bool_()), | ||
] | ||
) | ||
|
||
def call( | ||
self, | ||
parameters: dict, | ||
columns: tuple[str, ...], | ||
headers: dict[str, list[str]], | ||
) -> ArrowData: | ||
# sleep is intentionally setup to be longer than the deadline for | ||
# the function invocation (see conftest.py // flexconnect_server fixture) | ||
time.sleep(1) | ||
|
||
return pyarrow.table( | ||
data={ | ||
"col1": [1, 2, 3], | ||
"col2": ["a", "b", "c"], | ||
"col3": [True, False, True], | ||
}, | ||
schema=self.Schema, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters