pipeline configuration is now done via simport and a shared oahu.config:Config derivation

This commit is contained in:
Sandy Walsh 2014-07-15 02:04:59 +00:00
parent 1ad9509775
commit b0e70ce191
3 changed files with 40 additions and 9 deletions

28
oahu_config.py Normal file
View File

@ -0,0 +1,28 @@
import oahu.config
from oahu import mongodb_sync_engine as driver
from oahu import pipeline
from oahu import stream_rules
from oahu import trigger_callback
from oahu import trigger_rule
class Callback(object):
def on_trigger(self, stream):
print "Processing", stream
class Config(oahu.config.Config):
def get_sync_engine(self, callback=None):
inactive = trigger_rule.Inactive(60)
rule_id = "request-id" # Has to be consistent across yagi workers.
if not callback:
self.callback = Callback()
else:
self.callback = callback
by_request = stream_rules.StreamRule(rule_id,
["request_id", ],
inactive, self.callback)
rules = [by_request, ]
return driver.MongoDBSyncEngine(rules)

View File

@ -1,7 +1,7 @@
sessionname tach sessionname tach
hardstatus alwayslastline '%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})' hardstatus alwayslastline '%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
screen -t gen bash #screen -t gen bash
stuff "cd git/notigen/bin; python event_pump.py\r" #stuff "cd git/notigen/bin; python event_pump.py\r"
screen -t yagi1 bash screen -t yagi1 bash
stuff "cd git/yagi/bin; ./yagi-event --config ../../../shoebox.conf\r" stuff "cd git/yagi/bin; ./yagi-event --config ../../../shoebox.conf\r"
screen -t yagi2 bash screen -t yagi2 bash
@ -9,12 +9,12 @@ stuff "cd git/yagi/bin; ./yagi-event --config ../../../shoebox.conf\r"
screen -t quincy bash screen -t quincy bash
stuff "cd git/quincy/quincy; gunicorn --log-file=- api:api\r" stuff "cd git/quincy/quincy; gunicorn --log-file=- api:api\r"
screen -t expired bash screen -t expired bash
stuff "pipeline expired --polling_rate=2\r" stuff "pipeline expired \".|oahu_config:Config\" --polling_rate=2\r"
screen -t ready1 bash screen -t ready1 bash
stuff "pipeline ready --polling_rate=1\r" stuff "pipeline ready \".|oahu_config:Config\" --polling_rate=1\r"
screen -t ready2 bash screen -t ready2 bash
stuff "pipeline ready --polling_rate=1\r" stuff "pipeline ready \".|oahu_config:Config\" --polling_rate=1\r"
screen -t completed bash screen -t completed bash
stuff "pipeline completed --polling_rate=2\r" stuff "pipeline completed \".|oahu_config:Config\" --polling_rate=2\r"
screen -t bash bash screen -t bash bash
stuff "klugman events -h\r" stuff "klugman events -h\r"

View File

@ -31,16 +31,19 @@ routing_key = monitor.info
durable = True durable = True
max_messages = 100 max_messages = 100
# ------ NOTE ------
# Yagi is launched from sandbox/git/yagi/bin, so files are
# relative to there.
# ------------------
[oahu] [oahu]
# nothing yet config_class = ../../..|oahu_config:Config
[shoebox] [shoebox]
# Store in-process files in ./working # Store in-process files in ./working
# Move them to ./archive when full via the MoveFileCallback # Move them to ./archive when full via the MoveFileCallback
# Roll files every 1mb # Roll files every 1mb
# Yagi is launched from sandbox/git/yagi/bin, so files are
# relative to there.
working_directory=../../../data/working working_directory=../../../data/working
destination_folder=../../../data/archive destination_folder=../../../data/archive