Hi @<1720249421582569472:profile|NonchalantSeaanemone34>
pipeline decorator where lambda function call another function(say
xyz
) and during pipeline execution, error is thrown that
xyz
is not defined?
Each pipeline function becomes a standalone "script", which I assume if the lambda function is defined outside of the decorated pipeline component function, would throw an undefined error.
My suggestion would be to define the lambda function as a nested function inside the decorated pipeline function.
wdyt?
Hi @<1523701205467926528:profile|AgitatedDove14>
first of all many thanks to you for always replying promptly 🙂
Initially I thought function is defined outside that is why I was getting that error. However I am using this way and that also gives error:
@PipelineDecorator.component(return_values=["op"])
def step1():
op = "I am in step-1"
return op
@PipelineDecorator.component(return_values=["op"])
def step2(op):
return ( lambda op:step1(op))
While executing step2, I get error that step1 is not defined.
Hope this example is helpful.
Hi @<1720249421582569472:profile|NonchalantSeaanemone34>
Sorry I missed this message. Yeah the reason it's not working is because the way the returned value is stored and passed is by using 'pickle' , unfortunately python pickle does not support storing lambda functions...
https://docs.python.org/3/library/pickle.html#id8