Skip to content

Commit 0fc79ec

Browse files
add add_links func
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent c43dbce commit 0fc79ec

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/databricks/sql/cloudfetch/download_manager.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,25 @@ def _schedule_downloads(self):
101101
task = self._thread_pool.submit(handler.run)
102102
self._download_tasks.append(task)
103103

104+
def add_links(self, links: List[TSparkArrowResultLink]):
105+
"""
106+
Add more links to the download manager.
107+
Args:
108+
links: List of links to add
109+
"""
110+
for link in links:
111+
if link.rowCount <= 0:
112+
continue
113+
logger.debug(
114+
"ResultFileDownloadManager: adding file link, start offset {}, row count: {}".format(
115+
link.startRowOffset, link.rowCount
116+
)
117+
)
118+
self._pending_links.append(link)
119+
120+
# Make sure the download queue is always full
121+
self._schedule_downloads()
122+
104123
def _shutdown_manager(self):
105124
# Clear download handlers and shutdown the thread pool
106125
self._pending_links = []

0 commit comments

Comments
 (0)