Skip to content

Commit

Permalink
optional py workflow input data (#2057)
Browse files Browse the repository at this point in the history
  • Loading branch information
DatGuyJonathan authored Feb 21, 2025
1 parent 5738bcc commit 1c24eaf
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,15 @@ async def dynamic_activity(execution_input: ScriptExecutionInput) -> WorkflowSte
input_data = execution_input.input_data.get('data', execution_input.input_data) if execution_input.input_data else {}
log.info(f"Processed input_data for task: {input_data}")
if asyncio.iscoroutinefunction(task_func):
result = await task_func(input=input_data)
if input_data:
result = await task_func(input=input_data)
else:
result = await task_func()
else:
result = task_func(input=input_data)
if input_data:
result = task_func(input=input_data)
else:
result = task_func()

# Validate and encode result
if not isinstance(result, dict):
Expand Down

0 comments on commit 1c24eaf

Please sign in to comment.