Complete/Fail SDK action tasks (#4172)
This commit is contained in:
committed by
GitHub
parent
f299b5a854
commit
ae95b8dd35
@@ -15,6 +15,7 @@ from skyvern.forge.sdk.schemas.sdk_actions import (
|
|||||||
RunSdkActionRequest,
|
RunSdkActionRequest,
|
||||||
RunSdkActionResponse,
|
RunSdkActionResponse,
|
||||||
)
|
)
|
||||||
|
from skyvern.forge.sdk.schemas.tasks import TaskStatus
|
||||||
from skyvern.forge.sdk.services import org_auth_service
|
from skyvern.forge.sdk.services import org_auth_service
|
||||||
from skyvern.forge.sdk.workflow.models.workflow import (
|
from skyvern.forge.sdk.workflow.models.workflow import (
|
||||||
WorkflowRequestBody,
|
WorkflowRequestBody,
|
||||||
@@ -204,6 +205,25 @@ async def run_sdk_action(
|
|||||||
prompt=action.prompt,
|
prompt=action.prompt,
|
||||||
)
|
)
|
||||||
result = xpath_result
|
result = xpath_result
|
||||||
|
await app.DATABASE.update_task(
|
||||||
|
task_id=task.task_id,
|
||||||
|
organization_id=organization_id,
|
||||||
|
status=TaskStatus.completed,
|
||||||
|
)
|
||||||
|
except Exception as e:
|
||||||
|
await app.DATABASE.update_task(
|
||||||
|
task_id=task.task_id,
|
||||||
|
organization_id=organization_id,
|
||||||
|
status=TaskStatus.failed,
|
||||||
|
failure_reason=str(e),
|
||||||
|
)
|
||||||
|
LOG.error(
|
||||||
|
"SDK action failed",
|
||||||
|
action_type=action.type,
|
||||||
|
error=str(e),
|
||||||
|
exc_info=True,
|
||||||
|
)
|
||||||
|
raise
|
||||||
finally:
|
finally:
|
||||||
skyvern_context.reset()
|
skyvern_context.reset()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user