I have this code which tags outputs based on some data of the input file:
class filters(beam.DoFn):
def process(self, element):
data = json.loads(element)
yield TaggedOutput(data['EventName'],element)
I need help with the next step of writting the resulting tagged outputs:
tagged = lines | beam.ParDo(filters()).with_outputs('How can I dinamiclly acces this tags?')
So as you can see when I do '.with_outputs()' I dont know how many and what names are the taggs going to be so I can´t predict things like:
tag1 = tagged.tag1
Thank you for your help
UPDATE: this wont work cause with.outputs() is empty
tagged_data= lines | 'tagged data by key' >>
beam.ParDo(filters()).with_outputs()
for tag in tagged_data:
print('something')
output: WARNING:apache_beam.options.pipeline_options:Discarding unparseable args
but this will work
tagged_data= lines | 'tagged data by key' >>
beam.ParDo(filters()).with_outputs('tag1','tag2')
for tag in tagged_data:
print('something')
output:
something
something