Skip to content
Browse files

Merge pull request #390 from lukecampbell/transform_create_stream

Fixes Transforms making service calls during init.
  • Loading branch information...
2 parents d44e61c + 305fe1a commit d184b77c7f8efd2a575d0ae45fed21758608f882 @lukecampbell lukecampbell committed
Showing with 11 additions and 1 deletion.
  1. +11 −1 ion/core/process/transform.py
View
12 ion/core/process/transform.py
@@ -15,6 +15,7 @@
import gevent
import re
from pyon.util.log import log
+from copy import copy
dot = logging.getLogger('dot')
class TransformBase(SimpleProcess):
@@ -131,7 +132,16 @@ def on_start(self):
self.exchange_point = self.CFG.get_safe('process.exchange_point', 'science_data')
self.routing_key = self.CFG.get_safe('process.routing_key', '')
- self.publisher = StreamPublisher(process=self, stream_id=self.stream_id, exchange_point=self.exchange_point, routing_key=self.routing_key)
+ # We do not want processes to make service calls
+ # A StreamPublisher has a behavior built-in to create a stream
+ # If no stream_id and route are specified.
+ # We will use the container attached endpoints instead of making a new stream
+ if not (self.stream_id or self.routing_key):
+ output_streams = copy(self.CFG.get_safe('process.publish_streams'))
+ first_stream = output_streams.popitem()
+ self.publisher = first_stream[1]
+ else:
+ self.publisher = StreamPublisher(process=self, stream_id=self.stream_id, exchange_point=self.exchange_point, routing_key=self.routing_key)
def publish(self, msg, to_name):
'''

0 comments on commit d184b77

Please sign in to comment.
Something went wrong with that request. Please try again.