Skip to content

Commit

Permalink
Fix lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
jlowin committed May 17, 2024
1 parent 7c8c91a commit e577a4a
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/controlflow/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,14 @@ def wrapped_flow(*args, lazy_=None, **kwargs):
with controlflow.instructions(instructions):
result = fn(*args, **kwargs)

# determine if we should run the flow eagerly or lazily
# Determine if we should run eagerly or lazily
if lazy_ is not None:
lazy = lazy_
if lazy is None:
run_eagerly = controlflow.settings.eager_mode
else:
run_eagerly = not lazy_
elif lazy is not None:
run_eagerly = not lazy
else:
run_eagerly = controlflow.settings.eager_mode

if run_eagerly:
flow_obj.run()

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

# determine if we should run the flow eagerly or lazily
# Determine if we should run eagerly or lazily
if lazy_ is not None:
lazy = lazy_
if lazy is None:
run_eagerly = controlflow.settings.eager_mode
else:
run_eagerly = not lazy_
elif lazy is not None:
run_eagerly = not lazy
else:
run_eagerly = controlflow.settings.eager_mode

if run_eagerly:
task.run()
return task.result
Expand Down

0 comments on commit e577a4a

Please sign in to comment.