changes with utils

community
Steve Nyemba 7 years ago
parent 52af677bf5
commit 833407dd4c

@ -15,7 +15,7 @@ import monitor
import requests
class Manager() :
def version(self):
return 1.0
return 1.1
"""
delay : <value>
@ -29,7 +29,7 @@ class Manager() :
def init(self,**args) :
self.id = args['node']
self.agents = args['agents']
self.config = args['config']
self.config = dict(args['config'])
self.key = args['key']
self.actors = args['actors']
self.update() #-- Initializing status information
@ -42,7 +42,6 @@ class Manager() :
url="https://the-phi.com/store/status/monitor"
r = requests.get(url,headers={"uid":self.key})
plans = json.loads(r.text)
meta = [item['metadata'] for item in plans if item['status']=='active' ]
if len(meta) > 0 :
self.DELAY = 60* max([ int(item['delay']) for item in meta])
@ -58,7 +57,7 @@ class Manager() :
meta = meta[0]
self.agents = self.filter('agents',meta,self.agents)
self.actors = self.filter('actors',meta,self.actors)
self.setup(meta)
#self.setup(meta)
def filter_collectors(self,meta) :
"""

@ -20,7 +20,7 @@ class Register :
"""
self.class_write = args['write']
self.class_read = args['read']
self.store_args = args['store']
self.store_args = dict(args['store'])
self.default_plan = args['default']
self.factory = DataSourceFactory()
self.uid = args['uid']
@ -70,8 +70,8 @@ class Register :
key = self.get_key()
return {"key":key,"name":plan['name'],"info":[plan['metadata']]}
except Exception,e:
print e
except Exception as e:
print (str(e))
return None
def get_key(self) :
store = self.factory.instance(type=self.class_read,args=self.store_args)
@ -106,8 +106,14 @@ class Register :
def get_active_plan(self):
store = self.factory.instance(type=self.class_read,args=self.store_args)
id = store.view('federation/uid_map',key=self.uid)
return store.view('plans/active',key=id)
try:
r = store.view('plans/active',key=id)
return r
except Exception as e:
print (e)
return {}
def cancel(self,pid):
pass
def upgrade(self,pid):
pass
pass

Loading…
Cancel
Save