Commit 2e725562 authored by payno's avatar payno
Browse files

pep8 outData -> outData

parent ea706d65
......@@ -51,7 +51,7 @@ def trace_unhandled_exceptions(func):
@functools.wraps(func)
def wrapped_func(*args, **kwargs):
try:
outData = func(*args, **kwargs)
out_data = func(*args, **kwargs)
except Exception as e:
errorMessage = '{0}'.format(e)
logger.exception(errorMessage)
......@@ -61,7 +61,7 @@ def trace_unhandled_exceptions(func):
traceBack=traceBack,
data=args[1]
)
return outData
return out_data
return wrapped_func
......@@ -274,13 +274,13 @@ class PythonActor(AbstractActor):
self.error_handler.triggerOnError(inData=oldInData)
else:
# TODO: what can be inData ? a list ? namedtuple ?
outData = {}
out_data = {}
for key, value in inData.items():
if key in self.in_data:
if self.in_data[key] != value:
outData[key] = value
out_data[key] = value
else:
outData[key] = value
out_data[key] = value
# self.uploadDataToMongo(actorData={
# 'stopTime': datetime.datetime.now(),
# 'status': 'finished',
......
......@@ -38,7 +38,7 @@ class StopActor(object):
self.name = name
self.lock = multiprocessing.Lock()
self.lock.acquire()
self.outData = None
self.out_data = None
self.parent = parent
def trigger(self, inData):
......@@ -48,7 +48,7 @@ class StopActor(object):
if self.errorHandler is not None:
self.errorHandler.errorHandler.stopActor.trigger(inData)
else:
self.outData = inData
self.out_data = inData
self.lock.release()
def join(self, timeout=7200):
......
......@@ -51,9 +51,9 @@ class TestPythonActor(unittest.TestCase):
actor.connect(stopActor)
actor.trigger(inData)
stopActor.join(timeout=5)
outData = stopActor.outData
self.assertIsNotNone(outData)
self.assertEqual(outData['reply'], 'Hello Ragnar!')
out_data = stopActor.out_data
self.assertIsNotNone(out_data)
self.assertEqual(out_data['reply'], 'Hello Ragnar!')
def test_ErrorHandler(self):
script = 'pypushflow.test.pythonErrorHandlerTest.py'
......@@ -69,9 +69,9 @@ class TestPythonActor(unittest.TestCase):
errorHandler.connect(stopActor)
actor.trigger(inData)
stopActor.join(timeout=5)
outData = stopActor.outData
self.assertIsNotNone(outData)
self.assertTrue('WorkflowException' in outData)
out_data = stopActor.out_data
self.assertIsNotNone(out_data)
self.assertTrue('WorkflowException' in out_data)
def test_ForkAndJoinActors(self):
start = StartActor()
......@@ -93,9 +93,9 @@ class TestPythonActor(unittest.TestCase):
inData = {'a': 1}
start.trigger(inData)
stop.join(timeout=5)
outData = stop.outData
self.assertIsNotNone(outData)
logger.info(outData)
out_data = stop.out_data
self.assertIsNotNone(out_data)
logger.info(out_data)
def suite():
......
......@@ -51,30 +51,30 @@ class TestWorkflows(unittest.TestCase):
def test_Workflow1(self):
testWorkflow1 = Workflow1('Test workflow 1')
inData = {'name': 'Jerry'}
outData = testWorkflow1.run(inData)
self.assertIsNotNone(outData)
self.assertEqual(outData['reply'], 'Hello Jerry!')
out_data = testWorkflow1.run(inData)
self.assertIsNotNone(out_data)
self.assertEqual(out_data['reply'], 'Hello Jerry!')
def test_Workflow2(self):
testWorkflow2 = Workflow2('Test workflow 2')
inData = {'name': 'Tom'}
outData = testWorkflow2.run(inData)
self.assertIsNotNone(outData)
self.assertTrue('WorkflowException' in outData)
out_data = testWorkflow2.run(inData)
self.assertIsNotNone(out_data)
self.assertTrue('WorkflowException' in out_data)
def test_Workflow3(self):
testWorkflow3 = Workflow3('Test workflow 3')
inData = {'name': 'Cat'}
outData = testWorkflow3.run(inData)
self.assertIsNotNone(outData)
self.assertEqual(outData['reply'], 'Hello Cat!')
out_data = testWorkflow3.run(inData)
self.assertIsNotNone(out_data)
self.assertEqual(out_data['reply'], 'Hello Cat!')
def test_Workflow4(self):
testWorkflow4 = Workflow2('Test workflow 4')
inData = {'name': 'Dog'}
outData = testWorkflow4.run(inData)
self.assertIsNotNone(outData)
self.assertTrue('WorkflowException' in outData)
out_data = testWorkflow4.run(inData)
self.assertIsNotNone(out_data)
self.assertTrue('WorkflowException' in out_data)
def suite():
......
......@@ -44,7 +44,7 @@ def exec_(scheme, input_=None):
assert isinstance(scheme, ProcessableWorkflow)
scheme._start_actor.trigger(input_)
scheme._end_actor.join()
return scheme._end_actor.outData
return scheme._end_actor.out_data
class TestScheme(unittest.TestCase):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment