Add conditional block support for script caching (v2 - with bug fix) (#4642)
This commit is contained in:
@@ -20,8 +20,6 @@ from skyvern.forge.sdk.schemas.organizations import Organization
|
||||
from skyvern.forge.sdk.schemas.tasks import Task, TaskStatus
|
||||
from skyvern.forge.sdk.trace import traced
|
||||
from skyvern.forge.sdk.workflow.models.block import BlockTypeVar
|
||||
from skyvern.services import workflow_script_service
|
||||
from skyvern.webeye.actions.action_types import POST_ACTION_EXECUTION_ACTION_TYPES
|
||||
from skyvern.webeye.actions.actions import Action
|
||||
from skyvern.webeye.browser_state import BrowserState
|
||||
from skyvern.webeye.scraper.scraped_page import ELEMENT_NODE_ATTRIBUTES, CleanupElementTreeFunc, json_to_html
|
||||
@@ -601,42 +599,12 @@ class AgentFunction:
|
||||
if not settings.ENABLE_CODE_BLOCK:
|
||||
raise DisabledBlockExecutionError("CodeBlock is disabled")
|
||||
|
||||
# TODO: Remove these methods if nothing calls them after verifying in production
|
||||
async def _post_action_execution(self, action: Action) -> None:
|
||||
"""
|
||||
If this is a workflow running environment, generate the
|
||||
"""
|
||||
if action.action_type not in POST_ACTION_EXECUTION_ACTION_TYPES:
|
||||
return
|
||||
context = skyvern_context.current()
|
||||
if (
|
||||
not context
|
||||
or not context.root_workflow_run_id
|
||||
or not context.organization_id
|
||||
or not context.generate_script
|
||||
):
|
||||
return
|
||||
root_workflow_run_id = context.root_workflow_run_id
|
||||
organization_id = context.organization_id
|
||||
workflow_run = await app.DATABASE.get_workflow_run(
|
||||
workflow_run_id=root_workflow_run_id, organization_id=organization_id
|
||||
)
|
||||
if not workflow_run:
|
||||
return
|
||||
workflow = await app.DATABASE.get_workflow(
|
||||
workflow_id=workflow_run.workflow_id, organization_id=organization_id
|
||||
)
|
||||
if not workflow:
|
||||
return
|
||||
LOG.info(
|
||||
"Post action execution",
|
||||
root_workflow_run_id=context.root_workflow_run_id,
|
||||
organization_id=context.organization_id,
|
||||
)
|
||||
"""Post-action hook - now a no-op.
|
||||
|
||||
await workflow_script_service.generate_or_update_pending_workflow_script(
|
||||
workflow_run=workflow_run,
|
||||
workflow=workflow,
|
||||
)
|
||||
Script generation moved to block-level via _generate_pending_script_for_block() in service.py.
|
||||
"""
|
||||
|
||||
async def post_action_execution(self, action: Action) -> None:
|
||||
asyncio.create_task(self._post_action_execution(action))
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user