Hi :wave: , I am running a very straight forward F...
# ask-community
n
Hi đŸ‘‹ , I am running a very straight forward Flow and I got this error:
ValueError: Could not infer an active Flow context.
I find it quite cryptic. Can anyone please shed some light on what my issue may be? I have no clue right now : /
n
Hi @Newskooler - would you mind sharing some of your code?
n
Sure, I condensed it to the essential structure:
Copy code
@task
def extract() -> list:
    return get_info()


@task
def transform(raw_data: list) -> pd.DataFrame:
    return transform(raw_data)


@task
def save(mapped_data: pd.DataFrame) -> None:
    x = list(set(mapped_data.columns) & set(['a', 'b', 'c']))
    y = list(set(mapped_data.columns) & set(['1', '2', '3']))
    save_data(
        dataframe=mapped_data,
        x_axis=x,
        y_axis=y,
    )


with Flow(name='some name') as flow:
    raw_data = extract()
    mapped_data = transform(raw_data)
    save(mapped_data)

flow.storage = Local(directory='/some/location')
n
What happens when you remove the
save_data
call?
n
1 moment…
it does not fail
n
Ok good, that narrows it down. Something in your
save_data
method is trying to reference the flow context; is
save_data
a task?
n
Yes. I will look into the inputs there.
Thanks!
n
If that's the case, try returning the inputs from
save
and passing those to an explicit task call of
save_data
in the
with Flow() as flow:
block đŸ™‚
n
ohh.. this may be it… It’s a
task
inside a
task
n
Exactly!
n
Thanks : ))
n
đŸ˜„