Skip to content

Commit 7087b16

Browse files
committed
fix
Signed-off-by: oliver könig <[email protected]>
1 parent 9391ca7 commit 7087b16

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

nemo_run/core/execution/dgxcloud.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,13 @@ def _stream_url_sync(self, url: str, headers: Dict[str, str], q: queue.Queue):
352352
try:
353353
with requests.get(url, stream=True, headers=headers, verify=False) as response:
354354
for line in response.iter_lines(decode_unicode=True):
355-
q.put(f"{line}\n")
355+
q.put(url, f"{line}\n")
356356
except Exception as e:
357357
logger.error(f"Error streaming URL {url}: {e}")
358358

359+
finally:
360+
q.put(url, None)
361+
359362
def fetch_logs(
360363
self,
361364
job_id: str,
@@ -411,7 +414,11 @@ def fetch_logs(
411414

412415
# Yield chunks as they arrive
413416
while active_urls:
414-
yield q.get()
417+
url, item = q.get()
418+
if item is None:
419+
active_urls.discard(url)
420+
else:
421+
yield item
415422

416423
# Wait for threads
417424
for t in threads:

0 commit comments

Comments
 (0)