Skip to content

Commit

Permalink
Merge pull request #296 from PrefectHQ/p3
Browse files Browse the repository at this point in the history
Hotfix for prefect 3 compat
  • Loading branch information
jlowin authored Sep 9, 2024
2 parents 09d8ad3 + 00d8db9 commit 5a66f26
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/controlflow/utilities/prefect.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@
TaskRunContext,
)
from prefect.events.schemas.events import Event
from prefect.results import ResultFactory
from prefect.states import (
Cancelled,
Completed,
Failed,
Running,
return_value_to_state,
)
from prefect.utilities.asyncutils import run_coro_as_sync
from prefect.utilities.engine import (
Expand Down Expand Up @@ -223,17 +221,7 @@ def set_state(self, state: State) -> State:
return new_state

def succeed(self, result: Any):
if result is not None:
terminal_state = run_coro_as_sync(
return_value_to_state(
result,
result_factory=run_coro_as_sync(
ResultFactory.from_autonomous_task(self._task)
),
)
)
else:
terminal_state = Completed()
terminal_state = Completed()
self.set_state(terminal_state)

def fail(self, error: Optional[str] = None):
Expand Down

0 comments on commit 5a66f26

Please sign in to comment.