Created
April 22, 2018 18:53
-
-
Save jdye64/73cd14907228a83dff3d9a3629c4b129 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import codecs | |
def onTrigger(context, session): | |
flow_file = session.get() | |
if flow_file is not None: | |
log.info('got flow file: %s' % flow_file.getAttribute('filename')) | |
filename = flow_file.getAttribute('filename') | |
counter = filename.split('_')[1].split('.')[0] | |
log.info('counter is: %s' % counter) | |
weight_file = open('/tmp/weight/weight_' + counter + '.txt') | |
weight = weight_file.read() | |
weight_file.close() | |
log.info('Weight is: %s' % weight) | |
flow_file.addAttribute("weight", weight) | |
session.transfer(flow_file, REL_SUCCESS) 1,1 All |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment