Skip to content

Commit 422df4a

Browse files
authored
Merge pull request #50 from jlowin/lazy
Fix lazy
2 parents 7c8c91a + e577a4a commit 422df4a

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/controlflow/decorators.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,14 @@ def wrapped_flow(*args, lazy_=None, **kwargs):
9696
with controlflow.instructions(instructions):
9797
result = fn(*args, **kwargs)
9898

99-
# determine if we should run the flow eagerly or lazily
99+
# Determine if we should run eagerly or lazily
100100
if lazy_ is not None:
101-
lazy = lazy_
102-
if lazy is None:
103-
run_eagerly = controlflow.settings.eager_mode
104-
else:
101+
run_eagerly = not lazy_
102+
elif lazy is not None:
105103
run_eagerly = not lazy
104+
else:
105+
run_eagerly = controlflow.settings.eager_mode
106+
106107
if run_eagerly:
107108
flow_obj.run()
108109

@@ -194,13 +195,14 @@ def wrapper(*args, lazy_: bool = None, **kwargs):
194195
tools=tools or [],
195196
)
196197

197-
# determine if we should run the flow eagerly or lazily
198+
# Determine if we should run eagerly or lazily
198199
if lazy_ is not None:
199-
lazy = lazy_
200-
if lazy is None:
201-
run_eagerly = controlflow.settings.eager_mode
202-
else:
200+
run_eagerly = not lazy_
201+
elif lazy is not None:
203202
run_eagerly = not lazy
203+
else:
204+
run_eagerly = controlflow.settings.eager_mode
205+
204206
if run_eagerly:
205207
task.run()
206208
return task.result

0 commit comments

Comments
 (0)