Skip to content

Commit

Permalink
fix: fix kwargs not updated when pipeline is a Pipen object in `u…
Browse files Browse the repository at this point in the history
…tils.load_pipeline()`
  • Loading branch information
pwwang committed Aug 11, 2024
1 parent 3fde87c commit 66d885a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pipen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,16 @@ async def load_pipeline(
kwargs.setdefault("name", f"{obj.name}Pipeline")
pipeline = Pipen(**kwargs).set_starts(obj)

if isinstance(obj, type) and issubclass(obj, ProcGroup):
elif isinstance(obj, type) and issubclass(obj, ProcGroup):
pipeline = obj().as_pipen(**kwargs) # type: ignore

if isinstance(obj, type) and issubclass(obj, Pipen):
elif isinstance(obj, type) and issubclass(obj, Pipen):
# Avoid "pipeline" to be used as pipeline name by varname
(pipeline, ) = (obj(**kwargs), ) # type: ignore

else: # obj is a Pipen instance
pipeline._kwargs.update(kwargs)

if not isinstance(pipeline, Pipen):
raise TypeError(
"Expected a Pipen, Proc or ProcGroup class, "
Expand Down

0 comments on commit 66d885a

Please sign in to comment.