migrate observer to task v2 (#1564)
This commit is contained in:
@@ -9,7 +9,7 @@ from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType, LogEntityT
|
||||
from skyvern.forge.sdk.db.id import generate_artifact_id
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.schemas.ai_suggestions import AISuggestion
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverCruise, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverTask, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlock
|
||||
|
||||
LOG = structlog.get_logger(__name__)
|
||||
@@ -137,7 +137,7 @@ class ArtifactManager:
|
||||
|
||||
async def create_observer_cruise_artifact(
|
||||
self,
|
||||
observer_cruise: ObserverCruise,
|
||||
observer_cruise: ObserverTask,
|
||||
artifact_type: ArtifactType,
|
||||
data: bytes | None = None,
|
||||
path: str | None = None,
|
||||
@@ -203,7 +203,7 @@ class ArtifactManager:
|
||||
screenshots: list[bytes] | None = None,
|
||||
step: Step | None = None,
|
||||
observer_thought: ObserverThought | None = None,
|
||||
observer_cruise: ObserverCruise | None = None,
|
||||
observer_cruise: ObserverTask | None = None,
|
||||
ai_suggestion: AISuggestion | None = None,
|
||||
) -> None:
|
||||
if step:
|
||||
|
||||
@@ -3,7 +3,7 @@ from abc import ABC, abstractmethod
|
||||
from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType, LogEntityType
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.schemas.ai_suggestions import AISuggestion
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverCruise, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverTask, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlock
|
||||
|
||||
# TODO: This should be a part of the ArtifactType model
|
||||
@@ -52,7 +52,7 @@ class BaseStorage(ABC):
|
||||
|
||||
@abstractmethod
|
||||
def build_observer_cruise_uri(
|
||||
self, artifact_id: str, observer_cruise: ObserverCruise, artifact_type: ArtifactType
|
||||
self, artifact_id: str, observer_cruise: ObserverTask, artifact_type: ArtifactType
|
||||
) -> str:
|
||||
pass
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType, LogEntityT
|
||||
from skyvern.forge.sdk.artifact.storage.base import FILE_EXTENTSION_MAP, BaseStorage
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.schemas.ai_suggestions import AISuggestion
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverCruise, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverTask, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlock
|
||||
|
||||
LOG = structlog.get_logger()
|
||||
@@ -37,7 +37,7 @@ class LocalStorage(BaseStorage):
|
||||
return f"file://{self.artifact_path}/{settings.ENV}/observers/{observer_thought.observer_cruise_id}/{observer_thought.observer_thought_id}/{datetime.utcnow().isoformat()}_{artifact_id}_{artifact_type}.{file_ext}"
|
||||
|
||||
def build_observer_cruise_uri(
|
||||
self, artifact_id: str, observer_cruise: ObserverCruise, artifact_type: ArtifactType
|
||||
self, artifact_id: str, observer_cruise: ObserverTask, artifact_type: ArtifactType
|
||||
) -> str:
|
||||
file_ext = FILE_EXTENTSION_MAP[artifact_type]
|
||||
return f"file://{self.artifact_path}/{settings.ENV}/observers/{observer_cruise.observer_cruise_id}/{datetime.utcnow().isoformat()}_{artifact_id}_{artifact_type}.{file_ext}"
|
||||
|
||||
@@ -16,7 +16,7 @@ from skyvern.forge.sdk.artifact.models import Artifact, ArtifactType, LogEntityT
|
||||
from skyvern.forge.sdk.artifact.storage.base import FILE_EXTENTSION_MAP, BaseStorage
|
||||
from skyvern.forge.sdk.models import Step
|
||||
from skyvern.forge.sdk.schemas.ai_suggestions import AISuggestion
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverCruise, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.observers import ObserverTask, ObserverThought
|
||||
from skyvern.forge.sdk.schemas.workflow_runs import WorkflowRunBlock
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class S3Storage(BaseStorage):
|
||||
return f"s3://{self.bucket}/{settings.ENV}/observers/{observer_thought.observer_cruise_id}/{observer_thought.observer_thought_id}/{datetime.utcnow().isoformat()}_{artifact_id}_{artifact_type}.{file_ext}"
|
||||
|
||||
def build_observer_cruise_uri(
|
||||
self, artifact_id: str, observer_cruise: ObserverCruise, artifact_type: ArtifactType
|
||||
self, artifact_id: str, observer_cruise: ObserverTask, artifact_type: ArtifactType
|
||||
) -> str:
|
||||
file_ext = FILE_EXTENTSION_MAP[artifact_type]
|
||||
return f"s3://{self.bucket}/{settings.ENV}/observers/{observer_cruise.observer_cruise_id}/{datetime.utcnow().isoformat()}_{artifact_id}_{artifact_type}.{file_ext}"
|
||||
|
||||
Reference in New Issue
Block a user