Sync cloud skyvern to oss skyvern (#55)

This commit is contained in:
Kerem Yilmaz 2024-03-12 22:28:16 -07:00 committed by GitHub
parent 647ea2ac0f
commit 15d78d7b08
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 554 additions and 163 deletions

View file

@ -1,5 +1,6 @@
import abc
import structlog
from fastapi import BackgroundTasks
from skyvern.forge import app
@ -8,6 +9,8 @@ from skyvern.forge.sdk.core.skyvern_context import SkyvernContext
from skyvern.forge.sdk.models import Organization
from skyvern.forge.sdk.schemas.tasks import Task, TaskStatus
LOG = structlog.get_logger()
class AsyncExecutor(abc.ABC):
@abc.abstractmethod
@ -43,6 +46,7 @@ class BackgroundTaskExecutor(AsyncExecutor):
max_steps_override: int | None,
api_key: str | None,
) -> None:
LOG.info("Executing task using background task executor", task_id=task.task_id)
step = await app.DATABASE.create_step(
task.task_id,
order=0,
@ -52,7 +56,7 @@ class BackgroundTaskExecutor(AsyncExecutor):
task = await app.DATABASE.update_task(
task.task_id,
TaskStatus.running,
status=TaskStatus.running,
organization_id=organization.organization_id,
)
@ -78,6 +82,7 @@ class BackgroundTaskExecutor(AsyncExecutor):
max_steps_override: int | None,
api_key: str | None,
) -> None:
LOG.info("Executing workflow using background task executor", workflow_run_id=workflow_run_id)
background_tasks.add_task(
app.WORKFLOW_SERVICE.execute_workflow,
workflow_run_id=workflow_run_id,