Skip to content

Commit

Permalink
Adds simple_time kwarg to Streamer
Browse files Browse the repository at this point in the history
simple_time kwarg sets the time values to incremental values rather than 'now' values
  • Loading branch information
Christopher Mueller committed Jun 4, 2013
1 parent 3a3d56f commit 3380342
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ion/services/dm/test/dm_test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,24 @@ def activate_data_product(self, data_product_id):
self.addCleanup(self.data_product_management.suspend_data_product_persistence, data_product_id)

class Streamer(object):
def __init__(self, data_product_id, interval=1):
def __init__(self, data_product_id, interval=1, simple_time=False):
self.resource_registry = Container.instance.resource_registry
self.pubsub_management = PubsubManagementServiceClient()
self.data_product_id = data_product_id
self.i=0
self.interval = interval
self.simple_time = simple_time
self.finished = Event()
self.g = gevent.spawn(self.run)

def run(self):
while not self.finished.wait(self.interval):
gevent.sleep(self.interval)
rdt = ParameterHelper.rdt_for_data_product(self.data_product_id)
now = time.time()
rdt['time'] = np.array([now + 2208988800])
if self.simple_time:
rdt['time'] = [self.i]
else:
rdt['time'] = np.array([now + 2208988800])
rdt['temp'] = self.float_range(10,14,np.array([now]))
rdt['pressure'] = self.float_range(11,12,np.array([now]))
rdt['lat'] = [41.205]
Expand Down

0 comments on commit 3380342

Please sign in to comment.