Implement get_share_links (#302)

This commit is contained in:
Kerem Yilmaz 2024-05-13 00:03:31 -07:00 committed by GitHub
parent 6a83f367ba
commit 20a86590dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 41 additions and 38 deletions

View file

@ -451,7 +451,8 @@ class WorkflowService:
workflow_run = await self.get_workflow_run(workflow_run_id=workflow_run_id)
workflow_run_tasks = await app.DATABASE.get_tasks_by_workflow_run_id(workflow_run_id=workflow_run_id)
screenshot_urls = []
screenshot_artifacts = []
screenshot_urls: list[str] | None = None
# get the last screenshot for the last 3 tasks of the workflow run
for task in workflow_run_tasks[::-1]:
screenshot_artifact = await app.DATABASE.get_latest_artifact(
@ -460,11 +461,11 @@ class WorkflowService:
organization_id=organization_id,
)
if screenshot_artifact:
screenshot_url = await app.ARTIFACT_MANAGER.get_share_link(screenshot_artifact)
if screenshot_url:
screenshot_urls.append(screenshot_url)
if len(screenshot_urls) >= 3:
screenshot_artifacts.append(screenshot_artifact)
if len(screenshot_artifacts) >= 3:
break
if screenshot_artifacts:
screenshot_urls = await app.ARTIFACT_MANAGER.get_share_links(screenshot_artifacts)
recording_url = None
recording_artifact = await app.DATABASE.get_artifact_for_workflow_run(