From 77114725132486162948376bfefebdb31aacee73 Mon Sep 17 00:00:00 2001 From: "Steve L. Nyemba" Date: Tue, 29 Aug 2017 00:25:52 -0500 Subject: [PATCH] CO - Enabled configuration of actors and agents tied to plan --- src/api/.index.py.un~ | Bin 14394 -> 0 bytes src/api/index.py | 12 ++++-- src/utils/agents/actor.py | 5 ++- src/utils/agents/manager.py | 72 +++++++++++++++++++++++++++++++++--- 4 files changed, 80 insertions(+), 9 deletions(-) delete mode 100644 src/api/.index.py.un~ diff --git a/src/api/.index.py.un~ b/src/api/.index.py.un~ deleted file mode 100644 index 430d989f943aab1482fa52ec757886b7b580884f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14394 zcmeI(&yUn(7zgk!F0wE91C<|&h|NNrLDx|dH&M*Q#E2*=2n1wZ*Rh#)*TPPxv>kRw zO$;W+i$8-Nj6o9{){^vTw*m#<&BbnSzm{@VS;f$zTm@yrj7 zGx4+II6G7lWW6ME&!*j|;rBXmT2J;X`D9hriDGqSi^ZkYnVb9e>&d|$tzYn|EE@)! z{9k-@Ojc~2>#__Y{A8E^U4iFhL|#eRR#lbww5(IIf@5dS;W&TaEk7TX_2oht1Gf*A zp1qjcVTYS!Ef+YxB&)S6D>BYj$IfND7v*f?mv<-#wy9vX9mJV?DBpzLXeKyV(1B`_ zvIFB0SuGtE#W>WVdw}Vlms7n!bQ@Kc^h+z)Y@}S^h5^=!ieen7I1Ef`|Hru2U zx9QF=6rBZ~n<*Q}Rp+o5G^&hASXEL6uXjOvkhKoWj?yfZ)})%Ao-U|Bvx%|*n{?q| zK4Ph;GA5x8)x%7M>yKQ+DyqknS~?MUet`a3^x9cB={LeC&Ag}`)U$pZG~3HwnzjfErKQT4ggUg3GA+7FW`-5*0hRyKbPM0cg)msD*V106 z<0bt^qOKpLwV884zZuWhdZAxiC|%)*?-}I+V@zi4wXm$nI9napCcB=Jv%NyD{M!{Y zn<*Qx$-b6~YGNMhP(965=#n!;b;Gm;I$J0m$jRS!HeEi}p;X|4G}0GnGV z8Mw*L_Tol0F%NaD4zm^7m6^rW#AWc3<8tCiO?(A`S8 zf>n-XDXAvrp$_E{rbHLb6XiHlP*C1Rxr14bZE2|{=AjPlQKm&#y+*XNBd4HV9JeB` zv)(immbX*#aF&BxTdIk9sAGGaZP8W>WV>}>o6Hx#hs%32VA@J~fl$WTNeBK zP0T|bt9RK7ZPFpDalV^_awp{uW;wQ{rJ9(BI<)UGExIZq+C56`4HsS9Kx?`+`7VxU zd}+6rwB-xATfP?oG`zD^E&!FISj4g*V{LU1-)BVhPnQr63S$10Z}>w#++q0-b?C!B zfZjv@31G_^EHKr?Jk$aHkb%)#F#%5raIl211Na#OqIXgPROKzSxOj&NKKD^Vu#*ASi)vyX>UdpZ zFSJTVUYkp=&@aFMw1+YRo{X?yR1@=12kdhOL$CA*Z13Qy(3 0 : + # + # We should configure the actors accordingly and make sure they are operational + # + conf = {"folders":meta['folder_threshold'],"apps":None} + # + # We need to get the configuration for the apps remotely + # + read_class = self.config['store']['class']['read'] + read_args = self.config['store']['args'] + + couchdb = self.factory.instance(type=read_class,args=read_args) + uinfo = couchdb.view('config/apps',key=self.key) + if 'apps' in uinfo : + conf['apps'] = uinfo['apps'] + + mailer = None + for actor in self.actors : + id = actor.getIdentifier() + if id == "mailer" : + mailer = actor.Mailer() + if conf[id] is None : + continue + args = conf[id] + actor.init(args) + # + # Initializing the mailer + if mailer is not None and mailer in self.config: + mailer.init(self.config['mailer']) + return meta - + def setup(self,meta): + # + # We should configure the actors accordingly and make sure they are operational + # + conf = {"folders":meta['folder_threshold'],"apps":None} + # + # We need to get the configuration for the apps remotely + # + read_class = self.config['store']['class']['read'] + read_args = self.config['store']['args'] + + couchdb = self.factory.instance(type=read_class,args=read_args) + uinfo = couchdb.view('config/apps',key=self.key) + if 'apps' in uinfo : + conf['apps'] = uinfo['apps'] + + mailer = None + for actor in self.actors : + id = actor.getIdentifier() + if id == "mailer" : + mailer = actor.Mailer() + if conf[id] is None : + continue + args = conf[id] + actor.init(args) + # + # Initializing the mailer + if mailer is not None and mailer in self.config: + mailer.init(self.config['mailer']) + def isvalid(self): self.status() return self.DELAY > -1 and self.LIMIT > -1 @@ -85,6 +146,7 @@ class Manager() : print [channel,header] message = json.loads(stream) data = message['data'] + def run(self): #DELAY=35*60 #- 35 Minutes #LIMIT=1000 @@ -99,7 +161,7 @@ class Manager() : COUNT = 0 else: break - for agent in self.pool : + for agent in self.agents : data = agent.composite() label = agent.getName() node = '@'.join([label,self.id])