Upload downloaded files to S3 after every block so they can be used for subsequent blocks (#1801)

This commit is contained in:
Shuchang Zheng 2025-02-20 08:30:43 -08:00 committed by GitHub
parent d02b45c74c
commit 30d2bbd834
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View file

@ -1683,16 +1683,6 @@ class ForgeAgent:
step_id=last_step.step_id, step_id=last_step.step_id,
) )
# if it's a task block from workflow run,
# we don't need to close the browser, save browser artifacts, or call webhook
if task.workflow_run_id:
LOG.info(
"Task is part of a workflow run, not sending a webhook response",
task_id=task.task_id,
workflow_run_id=task.workflow_run_id,
)
return
if task.organization_id: if task.organization_id:
try: try:
async with asyncio.timeout(SAVE_DOWNLOADED_FILES_TIMEOUT): async with asyncio.timeout(SAVE_DOWNLOADED_FILES_TIMEOUT):
@ -1713,6 +1703,16 @@ class ForgeAgent:
workflow_run_id=task.workflow_run_id, workflow_run_id=task.workflow_run_id,
) )
# if it's a task block from workflow run,
# we don't need to close the browser, save browser artifacts, or call webhook
if task.workflow_run_id:
LOG.info(
"Task is part of a workflow run, not sending a webhook response",
task_id=task.task_id,
workflow_run_id=task.workflow_run_id,
)
return
await self.async_operation_pool.remove_task(task.task_id) await self.async_operation_pool.remove_task(task.task_id)
await self.cleanup_browser_and_create_artifacts( await self.cleanup_browser_and_create_artifacts(
close_browser_on_completion, last_step, task, browser_session_id=browser_session_id close_browser_on_completion, last_step, task, browser_session_id=browser_session_id

View file

@ -640,7 +640,7 @@ class BaseTaskBlock(Block):
downloaded_file_urls = await app.STORAGE.get_downloaded_files( downloaded_file_urls = await app.STORAGE.get_downloaded_files(
organization_id=workflow_run.organization_id, organization_id=workflow_run.organization_id,
task_id=updated_task.task_id, task_id=updated_task.task_id,
workflow_run_id=workflow_run_id, workflow_run_id=None,
) )
except asyncio.TimeoutError: except asyncio.TimeoutError:
LOG.warning("Timeout getting downloaded files", task_id=updated_task.task_id) LOG.warning("Timeout getting downloaded files", task_id=updated_task.task_id)
@ -699,7 +699,7 @@ class BaseTaskBlock(Block):
downloaded_file_urls = await app.STORAGE.get_downloaded_files( downloaded_file_urls = await app.STORAGE.get_downloaded_files(
organization_id=workflow_run.organization_id, organization_id=workflow_run.organization_id,
task_id=updated_task.task_id, task_id=updated_task.task_id,
workflow_run_id=workflow_run_id, workflow_run_id=None,
) )
except asyncio.TimeoutError: except asyncio.TimeoutError:
LOG.warning("Timeout getting downloaded files", task_id=updated_task.task_id) LOG.warning("Timeout getting downloaded files", task_id=updated_task.task_id)