complete_on_downloads for task block (#403)

This commit is contained in:
Kerem Yilmaz
2024-06-02 23:24:30 -07:00
committed by GitHub
parent 343937e12c
commit f1d5a3a687
9 changed files with 118 additions and 30 deletions

View File

@@ -217,7 +217,7 @@ class WorkflowRunContext:
self, parameter: OutputParameter, value: dict[str, Any] | list | str | None
) -> None:
if parameter.key in self.values:
LOG.error(f"Output parameter {parameter.output_parameter_id} already has a registered value")
LOG.warning(f"Output parameter {parameter.output_parameter_id} already has a registered value")
return
self.values[parameter.key] = value

View File

@@ -71,6 +71,14 @@ class Block(BaseModel, abc.ABC):
workflow_run_id: str,
value: dict[str, Any] | list | str | None = None,
) -> None:
if workflow_run_context.has_value(self.output_parameter.key):
LOG.warning(
"Output parameter value already recorded",
output_parameter_id=self.output_parameter.output_parameter_id,
workflow_run_id=workflow_run_id,
)
return
await workflow_run_context.register_output_parameter_value_post_execution(
parameter=self.output_parameter,
value=value,
@@ -150,6 +158,7 @@ class TaskBlock(Block):
max_retries: int = 0
max_steps_per_run: int | None = None
parameters: list[PARAMETER_TYPE] = []
complete_on_download: bool = False
def get_all_parameters(
self,
@@ -265,6 +274,7 @@ class TaskBlock(Block):
task=task,
step=step,
workflow_run=workflow_run,
complete_on_download=self.complete_on_download,
)
except Exception as e:
# Make sure the task is marked as failed in the database before raising the exception

View File

@@ -87,6 +87,7 @@ class TaskBlockYAML(BlockYAML):
max_retries: int = 0
max_steps_per_run: int | None = None
parameter_keys: list[str] | None = None
complete_on_download: bool = False
class ForLoopBlockYAML(BlockYAML):

View File

@@ -969,6 +969,7 @@ class WorkflowService:
error_code_mapping=block_yaml.error_code_mapping,
max_steps_per_run=block_yaml.max_steps_per_run,
max_retries=block_yaml.max_retries,
complete_on_download=block_yaml.complete_on_download,
)
elif block_yaml.block_type == BlockType.FOR_LOOP:
loop_blocks = [