Reputation: 471
I am trying to automate an I created a custom operator in airflow which reads from a custom util plugin what I built and it should return multiple values.
This is a sample of a util I built which reads the data from s3, cleans it and transforms it.
ClassA:
def __init__(self, *args, **kwargs):
initialization
def get_data(self):
*******
data import from s3 and
data processing script
********
return A,B,C,D,E
And this is how my custom operator looks like
from util import classA
from airflow.models import BaseOperator
from airflow.plugins_manager import AirflowPlugin
from airflow.utils.decorators import apply_defaults
class SFScoreDataOperator(BaseOperator):
@apply_defaults
def __init__(self):
Initialization parameters
def execute(self, context):
A,B,C,D,E = ClassA().get_data()
What I am trying to do passing those A,B,C,D,E variables to the next operator but airflow throws an error saying
A,B,C,D,E = ClassA().get_data()
TypeError: 'tuple' object is not callable
I'd really appreciate if I can get some help with that error
Upvotes: 0
Views: 554
Reputation: 4366
Your get_data
method is decorated with the @property
decorator which mean it's no longer callable (it could be if you returned a callable but that's besides the point) -- the decorator makes the get_data
method behave like an attribute, your A,B,C,D,E = ClassA().get_data()
is functionally equivalent to this:
A, B, C, D, E = ("Value A", "Value B", "Value C", "Value D", "Value E")
get_data = (A, B, C, D, E)
get_data() # <-- There's your problem, you can't call `tuple` objects.
TLDR: Remove the @property
decorator from your SuccessFactorData.get_data
ore change your usage from A,B,C,D,E = ClassA().get_data()
to A,B,C,D,E = ClassA().get_data
-- do one or the other and you should stop receiving your error.
Upvotes: 2