From b7effb6a149e57bf6960e16a90b10f03a2289264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oswaldo=20Alcal=C3=A1?= Date: Tue, 26 Aug 2025 11:49:03 -0400 Subject: [PATCH 1/4] fix(execute.py): fixing bad arguments for cli functions Instead of calling the func.main() with the reformated arguments, we call the func.callback() that accepts the Python formatted arguments. --- workflow/lifecycle/execute.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/workflow/lifecycle/execute.py b/workflow/lifecycle/execute.py index 553faff..64cfc48 100644 --- a/workflow/lifecycle/execute.py +++ b/workflow/lifecycle/execute.py @@ -39,11 +39,13 @@ def function(work: Work) -> Work: parameters: Dict[str, Any] = work.parameters or {} if isinstance(func, click.Command): - arguments = configure.arguments(func, work) - logger.info( - f"executing: {func.name}.main(args={arguments}, standalone_mode=False)" - ) - outcome = func.main(args=arguments, standalone_mode=False) + # arguments = configure.arguments(func, work) + # logger.info( + # f"executing: {func.name}.main(args={arguments}, standalone_mode=False)" + # ) + # outcome = func.main(args=arguments, standalone_mode=False) + # This will send the parameters as keyword arguments + outcome = func.callback(**parameters) # type: ignore else: logger.info( f"executing as python function: {func.__name__}(**{work.parameters})" From dd6b01f8e63c0f9fa44315174c46f90e73ebb210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oswaldo=20Alcal=C3=A1?= Date: Tue, 26 Aug 2025 12:03:22 -0400 Subject: [PATCH 2/4] fix(execute.py): precommit fixes --- workflow/lifecycle/execute.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workflow/lifecycle/execute.py b/workflow/lifecycle/execute.py index 64cfc48..5a2bedb 100644 --- a/workflow/lifecycle/execute.py +++ b/workflow/lifecycle/execute.py @@ -7,7 +7,6 @@ import click from workflow.definitions.work import Work -from workflow.lifecycle import configure from workflow.utils import validate from workflow.utils.logger import get_logger @@ -35,7 +34,7 @@ def function(work: Work) -> Work: try: assert isinstance(work.function, str), "missing function to execute" func: Callable[..., Any] = validate.function(work.function) - arguments: List[str] = [] + # arguments: List[str] = [] parameters: Dict[str, Any] = work.parameters or {} if isinstance(func, click.Command): From 68223c2034c193f91e4d28122bb01df1faa44b48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oswaldo=20Alcal=C3=A1?= Date: Tue, 26 Aug 2025 16:31:54 -0400 Subject: [PATCH 3/4] fix(posix.py): fixing testing functions --- workflow/examples/function.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/workflow/examples/function.py b/workflow/examples/function.py index 816ef71..2bd436a 100644 --- a/workflow/examples/function.py +++ b/workflow/examples/function.py @@ -79,7 +79,6 @@ def worker(work: Work) -> Work: @click.option( "--alpha", "-a", - default=1.0, type=FirstOf(click.FLOAT, click.INT), required=True, help="A number.", @@ -87,9 +86,9 @@ def worker(work: Work) -> Work: @click.option( "--beta", "-b", - default=2.0, + default=1, type=FirstOf(click.FLOAT, click.INT), - required=True, + required=False, help="Another number.", ) @click.option( @@ -100,7 +99,7 @@ def worker(work: Work) -> Work: default=False, ) def cli( - alpha: Union[float, int], beta: Union[float, int], verbose: bool + alpha: Union[float, int], beta: Union[float, int] = 1.0, verbose: bool = False ) -> Tuple[Dict[str, float], List[str], List[str]]: """Click command for the math function.""" results, products, plots = math(alpha, beta) From aa097500b7445333a87937deeca0c75abb08a0b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oswaldo=20Alcal=C3=A1?= Date: Tue, 26 Aug 2025 16:41:24 -0400 Subject: [PATCH 4/4] fix(test_lifecycle.py): fixing test --- tests/test_lifecycle.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_lifecycle.py b/tests/test_lifecycle.py index 0bf2906..d9a92d9 100644 --- a/tests/test_lifecycle.py +++ b/tests/test_lifecycle.py @@ -66,7 +66,7 @@ def test_cli_with_partials(): work.function = "workflow.examples.function.cli" work.parameters = {"alpha": 5} work = execute.function(work) - results, products, plots = math(alpha=5, beta=2) + results, products, plots = math(alpha=5) assert work.results == results assert work.products == products assert work.plots == plots