WorkflowRunStatusResponse -> WorkflowRunResponse (#1959)
This commit is contained in:
@@ -70,8 +70,8 @@ from skyvern.forge.sdk.workflow.models.workflow import (
|
||||
Workflow,
|
||||
WorkflowRequestBody,
|
||||
WorkflowRun,
|
||||
WorkflowRunResponse,
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunStatusResponse,
|
||||
WorkflowStatus,
|
||||
)
|
||||
from skyvern.forge.sdk.workflow.models.yaml import WorkflowCreateYAMLRequest
|
||||
@@ -714,17 +714,17 @@ async def get_workflow_run_timeline(
|
||||
|
||||
@base_router.get(
|
||||
"/workflows/runs/{workflow_run_id}",
|
||||
response_model=WorkflowRunStatusResponse,
|
||||
response_model=WorkflowRunResponse,
|
||||
)
|
||||
@base_router.get(
|
||||
"/workflows/runs/{workflow_run_id}/",
|
||||
response_model=WorkflowRunStatusResponse,
|
||||
response_model=WorkflowRunResponse,
|
||||
include_in_schema=False,
|
||||
)
|
||||
async def get_workflow_run(
|
||||
workflow_run_id: str,
|
||||
current_org: Organization = Depends(org_auth_service.get_current_org),
|
||||
) -> WorkflowRunStatusResponse:
|
||||
) -> WorkflowRunResponse:
|
||||
analytics.capture("skyvern-oss-agent-workflow-run-get")
|
||||
return await app.WORKFLOW_SERVICE.build_workflow_run_status_response_by_workflow_id(
|
||||
workflow_run_id=workflow_run_id,
|
||||
|
||||
@@ -130,7 +130,7 @@ class WorkflowRunOutputParameter(BaseModel):
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class WorkflowRunStatusResponse(BaseModel):
|
||||
class WorkflowRunResponse(BaseModel):
|
||||
workflow_id: str
|
||||
workflow_run_id: str
|
||||
status: WorkflowRunStatus
|
||||
|
||||
@@ -79,8 +79,8 @@ from skyvern.forge.sdk.workflow.models.workflow import (
|
||||
WorkflowRun,
|
||||
WorkflowRunOutputParameter,
|
||||
WorkflowRunParameter,
|
||||
WorkflowRunResponse,
|
||||
WorkflowRunStatus,
|
||||
WorkflowRunStatusResponse,
|
||||
WorkflowStatus,
|
||||
)
|
||||
from skyvern.forge.sdk.workflow.models.yaml import (
|
||||
@@ -949,7 +949,7 @@ class WorkflowService:
|
||||
workflow_run_id: str,
|
||||
organization_id: str,
|
||||
include_cost: bool = False,
|
||||
) -> WorkflowRunStatusResponse:
|
||||
) -> WorkflowRunResponse:
|
||||
workflow_run = await self.get_workflow_run(workflow_run_id=workflow_run_id, organization_id=organization_id)
|
||||
if workflow_run is None:
|
||||
LOG.error(f"Workflow run {workflow_run_id} not found")
|
||||
@@ -968,7 +968,7 @@ class WorkflowService:
|
||||
workflow_run_id: str,
|
||||
organization_id: str,
|
||||
include_cost: bool = False,
|
||||
) -> WorkflowRunStatusResponse:
|
||||
) -> WorkflowRunResponse:
|
||||
workflow = await self.get_workflow_by_permanent_id(workflow_permanent_id)
|
||||
if workflow is None:
|
||||
LOG.error(f"Workflow {workflow_permanent_id} not found")
|
||||
@@ -1064,7 +1064,7 @@ class WorkflowService:
|
||||
# successful steps are the ones that have a status of completed and the total count of unique step.order
|
||||
successful_steps = [step for step in workflow_run_steps if step.status == StepStatus.completed]
|
||||
total_cost = 0.1 * (len(successful_steps) + len(text_prompt_blocks))
|
||||
return WorkflowRunStatusResponse(
|
||||
return WorkflowRunResponse(
|
||||
workflow_id=workflow.workflow_permanent_id,
|
||||
workflow_run_id=workflow_run_id,
|
||||
status=workflow_run.status,
|
||||
|
||||
Reference in New Issue
Block a user