Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if export_params is None:
export_params = {}
if 'format' in export_params:
compression = False
else:
compression = self.options['compression']
if query_params is not None:
query_or_table = self.format.format(query_or_table, **query_params)
try:
http_proc = ExaHTTPProcess(self.ws_host, self.ws_port, compression, self.options['encryption'], HTTP_EXPORT)
http_proc.start()
sql_thread = ExaSQLExportThread(self, http_proc.get_proxy(), compression, query_or_table, export_params)
sql_thread.set_http_proc(http_proc)
sql_thread.start()
result = callback(http_proc.read_pipe, dst, **callback_params)
http_proc.read_pipe.close()
http_proc.join()
sql_thread.join()
return result
except Exception as e:
# Close HTTP Server if it is still running
if 'http_proc' in locals():
http_proc.terminate()
# Give higher priority to SQL thread exception
from .http_transport import ExaSQLExportThread
if export_params is None:
export_params = {}
if 'format' in export_params:
compression = False
else:
compression = self.options['compression']
if query_params is not None:
query_or_table = self.format.format(query_or_table, **query_params)
# There is no need to run separate thread here, all work is performed in child processes
# We simply reuse thread class to keep logic in one place
sql_thread = ExaSQLExportThread(self, exa_proxy_list, compression, query_or_table, export_params)
sql_thread.run_sql()