or rather than str(self)
, something like:
def __repr__(self):
return self.__class__.__name__ + "." + self.name
should work better
Hi @<1643060801088524288:profile|HarebrainedOstrich43> ! At the moment, we don't support default arguments that are typed via a class implemented in the same module as the function.
The way pipelines work is: we copy the code of the function steps (eventually their decorator's as well if declared in the same file), then we copy all the imports in the module. Problem is, we don't copy classes.
You could have your enum in a separate file, import it and it should work
@<1643060801088524288:profile|HarebrainedOstrich43> you are right. we actually attempt to copy the default arguments as well. What happens is that we aggregate these arguments in the kwargs
dict, then we dump str(kwargs)
in the script of the pipeline step. Problem is, str(dict)
actually calls __
repr_
_
on each key/value of the dict, so you end up with repr(MyEnum.FALSE)
in your code, which is <MyEnum.FALSE: 'FALSE'>
. One way to work around this is to add something like:
class MyEnum(Enum):
FALSE = "FALSE"
TRUE = "TRUE"
def __repr__(self):
return str(self) # notice this
to your enum
Hi @<1523701435869433856:profile|SmugDolphin23> , thank you for getting back to me. I actually have my Enum in a separate file. I have tried importing it both to the context (file with pipeline component) and to inside of the pipeline component function. Unfortunatelly it does not work. The same scenario for pipeline itself works perfectly fine (when Enum is imported to the context, aka .py file with pipeline code).
Important : it only fails when default value is provided. Simply defining the type works fine for both pipeline and pipeline components.
@<1523701435869433856:profile|SmugDolphin23> thank you for such a detailed explanation! I will give it a try now :)