mirror of
https://github.com/Skyvern-AI/skyvern.git
synced 2025-09-16 18:29:40 +00:00
Misc loop block changes (#1494)
This commit is contained in:
parent
a241b09701
commit
74c8dd45f5
4 changed files with 18 additions and 9 deletions
|
@ -263,6 +263,10 @@ class Block(BaseModel, abc.ABC):
|
|||
artifact_type=ArtifactType.SCREENSHOT_LLM,
|
||||
data=screenshot,
|
||||
)
|
||||
|
||||
LOG.info(
|
||||
"Executing block", workflow_run_id=workflow_run_id, block_label=self.label, block_type=self.block_type
|
||||
)
|
||||
return await self.execute(workflow_run_id, workflow_run_block_id, organization_id=organization_id, **kwargs)
|
||||
except Exception as e:
|
||||
LOG.exception(
|
||||
|
@ -278,7 +282,7 @@ class Block(BaseModel, abc.ABC):
|
|||
|
||||
failure_reason = "unexpected exception"
|
||||
if isinstance(e, SkyvernException):
|
||||
failure_reason = f"unexpected SkyvernException({e.__class__.__name__})"
|
||||
failure_reason = f"unexpected SkyvernException({e.__class__.__name__}): {str(e)}"
|
||||
|
||||
return await self.build_block_result(
|
||||
success=False,
|
||||
|
@ -843,13 +847,17 @@ class ForLoopBlock(Block):
|
|||
parent_workflow_run_block_id=workflow_run_block_id,
|
||||
organization_id=organization_id,
|
||||
)
|
||||
|
||||
output_value = (
|
||||
workflow_run_context.get_value(block_output.output_parameter.key)
|
||||
if workflow_run_context.has_value(block_output.output_parameter.key)
|
||||
else None
|
||||
)
|
||||
each_loop_output_values.append(
|
||||
{
|
||||
"loop_value": loop_over_value,
|
||||
"output_parameter": block_output.output_parameter,
|
||||
"output_value": workflow_run_context.get_value(block_output.output_parameter.key)
|
||||
if workflow_run_context.has_value(block_output.output_parameter.key)
|
||||
else None,
|
||||
"output_value": output_value,
|
||||
}
|
||||
)
|
||||
try:
|
||||
|
@ -886,12 +894,13 @@ class ForLoopBlock(Block):
|
|||
|
||||
if not block_output.success and not loop_block.continue_on_failure:
|
||||
LOG.info(
|
||||
f"ForLoopBlock: Encountered an failure processing block {block_idx} during loop {loop_idx}, terminating early",
|
||||
f"ForLoopBlock: Encountered a failure processing block {block_idx} during loop {loop_idx}, terminating early",
|
||||
block_outputs=block_outputs,
|
||||
loop_idx=loop_idx,
|
||||
block_idx=block_idx,
|
||||
loop_over_value=loop_over_value,
|
||||
loop_block_continue_on_failure=loop_block.continue_on_failure,
|
||||
failure_reason=block_output.failure_reason,
|
||||
)
|
||||
outputs_with_loop_values.append(each_loop_output_values)
|
||||
return LoopBlockExecutedResult(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue