Skip to content

Commit

Permalink
Merge 338884a into 1d36078
Browse files Browse the repository at this point in the history
  • Loading branch information
antesaj committed Apr 5, 2023
2 parents 1d36078 + 338884a commit ee8a758
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
19 changes: 10 additions & 9 deletions tabpy/tabpy_server/app/app.py
Expand Up @@ -152,16 +152,16 @@ def run(self):
f"{str(self.settings[SettingsParameters.Port])}"
)

# Define a function for the thread
def start_pyarrow():
self.arrow_server = self._get_arrow_server(self.settings)
pa.start(self.arrow_server)
if self.settings[SettingsParameters.ArrowEnabled]:
def start_pyarrow():
self.arrow_server = self._get_arrow_server(self.settings)
pa.start(self.arrow_server)

try:
_thread.start_new_thread(start_pyarrow, ())
except Exception as e:
print(e)
print("Error: unable to start pyarrow server")
try:
_thread.start_new_thread(start_pyarrow, ())
except Exception as e:
print(e)
print("Error: unable to start pyarrow server")

tornado.ioloop.IOLoop.instance().start()

Expand Down Expand Up @@ -339,6 +339,7 @@ def _parse_config(self, config_file):
100, None),
(SettingsParameters.GzipEnabled, ConfigParameters.TABPY_GZIP_ENABLE,
True, parser.getboolean),
(SettingsParameters.ArrowEnabled, ConfigParameters.TABPY_ENABLE_ARROW, False, parser.getboolean),
(SettingsParameters.ArrowFlightPort, ConfigParameters.TABPY_ARROWFLIGHT_PORT, 13622, parser.getint),
]

Expand Down
2 changes: 2 additions & 0 deletions tabpy/tabpy_server/app/app_parameters.py
Expand Up @@ -18,6 +18,7 @@ class ConfigParameters:
TABPY_GZIP_ENABLE = "TABPY_GZIP_ENABLE"

# Arrow specific settings
TABPY_ENABLE_ARROW = "TABPY_ENABLE_ARROW"
TABPY_ARROWFLIGHT_PORT = "TABPY_ARROWFLIGHT_PORT"


Expand All @@ -42,4 +43,5 @@ class SettingsParameters:
GzipEnabled = "gzip_enabled"

# Arrow specific settings
ArrowEnabled = "arrow_enabled"
ArrowFlightPort = "arrowflight_port"
4 changes: 2 additions & 2 deletions tabpy/tabpy_server/handlers/evaluation_plane_handler.py
Expand Up @@ -76,7 +76,7 @@ def _post_impl(self):
user_code = body["script"]
arguments = None
arguments_str = ""
if "dataPath" in body:
if self.arrow_server is not None and "dataPath" in body:
# arrow flight scenario
print("arrow flight scenario")
arrow_data = self.get_arrow_data(body["dataPath"])
Expand Down Expand Up @@ -123,7 +123,7 @@ def _post_impl(self):
return

if result is not None:
if "dataPath" in body:
if self.arrow_server is not None and "dataPath" in body:
# arrow flight scenario
output_data_id = str(uuid.uuid4())
self.upload_arrow_data(result, output_data_id, {
Expand Down

0 comments on commit ee8a758

Please sign in to comment.