Skip to content

Commit 4800e6d

Browse files
committed
Tweaks code to auto tag
1 parent f8bf58d commit 4800e6d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

examples/cmdline_orchestrator/cmdline.py

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from hamilton.execution.executors import DefaultExecutionManager, TaskExecutor
55
from hamilton.execution.grouping import TaskImplementation
6+
from hamilton.function_modifiers import tag
67

78

89
class CMDLineExecutionManager(DefaultExecutionManager):
@@ -54,4 +55,5 @@ def wrapper(*args, **kwargs):
5455
if inspect.isgeneratorfunction(func):
5556
# get the return type and set it as the return type of the wrapper
5657
wrapper.__annotations__["return"] = inspect.signature(func).return_annotation[2]
58+
wrapper = tag(cmdline="yes")(wrapper)
5759
return wrapper

examples/cmdline_orchestrator/funcs.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@
66
from hamilton.function_modifiers import tag
77

88

9-
@tag(cmdline="yes", cache="pickle")
9+
@tag(cache="pickle")
1010
@cmdline_decorator
1111
def echo_1(start: str) -> str:
1212
time.sleep(2)
1313
return f'echo "1: {start}"'
1414

1515

16-
@tag(cmdline="yes", cache="pickle")
16+
@tag(cache="pickle")
1717
@cmdline_decorator
1818
def echo_2(echo_1: str) -> str:
1919
time.sleep(2)
2020
return f'echo "2: {echo_1}"'
2121

2222

23-
@tag(cmdline="yes", cache="pickle")
23+
@tag(cache="pickle")
2424
@cmdline_decorator
2525
def echo_2b(echo_1: str) -> [str, CompletedProcess, str]:
2626
# preprocess
@@ -35,7 +35,7 @@ def echo_2b(echo_1: str) -> [str, CompletedProcess, str]:
3535
return output
3636

3737

38-
@tag(cmdline="yes", cache="pickle")
38+
@tag(cache="pickle")
3939
@cmdline_decorator
4040
def echo_3(echo_2: str, echo_2b: str) -> str:
4141
return f'echo "3: {echo_2 + ":::" + echo_2b}"'

0 commit comments

Comments
 (0)