From ff367dfcc74381d04d7ae61f4868da501372c936 Mon Sep 17 00:00:00 2001 From: Sandy Walsh Date: Thu, 14 Aug 2014 20:49:06 +0000 Subject: [PATCH] working with template based notigen --- oahu_config.py | 29 ++++++++++++++++++++++------- screenrc | 2 +- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/oahu_config.py b/oahu_config.py index 344b8cd..7f964bb 100644 --- a/oahu_config.py +++ b/oahu_config.py @@ -12,20 +12,35 @@ class Callback(pipeline_callback.PipelineCallback): class Config(oahu.config.Config): def get_driver(self, callback=None): - inactive = criteria.Inactive(60) - trigger_name = "request-id" # Has to be consistent across yagi workers. if not callback: self.callback = Callback() else: self.callback = callback - by_request = trigger_definition.TriggerDefinition(trigger_name, - ["request_id", ], - inactive, - self.callback) - triggers = [by_request, ] + + # Trigger names have to be consistent across all workers + # (yagi and daemons). + by_request = trigger_definition.TriggerDefinition("request-id", + ["_context_request_id", ], + criteria.Inactive(60), + self.callback) + + # This trigger requires a Trait called "when_date" which is + # the date-only portion of the "when" trait. We will create + # streams based on uuid for a given day. The distiller will + # create this trait for us. + instance_usage = trigger_definition.TriggerDefinition("instance_id", + ["payload/instance_id", "audit_bucket"], + criteria.EndOfDayExists( + 'compute.instance.exists'), + self.callback) + + triggers = [by_request, instance_usage] return driver.MongoDBDriver(triggers) + def get_distiller_config(self): + return "" + def get_ready_chunk_size(self): return 100 diff --git a/screenrc b/screenrc index 9432f29..443357a 100644 --- a/screenrc +++ b/screenrc @@ -1,7 +1,7 @@ sessionname tach hardstatus alwayslastline '%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})' screen -t gen bash -stuff "cd git/notigen/bin; python event_pump.py\r" +stuff "cd git/notigen/bin; python event_pump.py ../templates 60\r" screen -t yagi1 bash stuff "cd git/yagi/bin; ./yagi-event --config ../../../shoebox.conf\r" screen -t yagi2 bash