本文整理汇总了Python中store.Store.getstore方法的典型用法代码示例。如果您正苦于以下问题:Python Store.getstore方法的具体用法?Python Store.getstore怎么用?Python Store.getstore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类store.Store
的用法示例。
在下文中一共展示了Store.getstore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_db_init
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import getstore [as 别名]
def post_db_init(self):
'''Create IS_A relationship to our 'class' node in the database, and set creation time'''
if not self._baseinitfinished:
self._baseinitfinished = True
if Store.is_abstract(self) and self.nodetype != CMAconsts.NODE_nodetype:
store = Store.getstore(self)
if self.nodetype not in GraphNode.classtypeobjs:
GraphNode.initclasstypeobj(store, self.nodetype)
store.relate(self, CMAconsts.REL_isa, GraphNode.classtypeobjs[self.nodetype])
assert GraphNode.classtypeobjs[self.nodetype].name == self.nodetype
self.time_create_ms = int(round(time.time()*1000))
self.time_create_iso8601 = time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime())
示例2: childfactory
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import getstore [as 别名]
def childfactory(parentsystem, childtype, designation, jsonobj, roles=None, domain=None):
'We construct an appropriate ChildSystem subclass object - or find it in the database'
store = Store.getstore(parentsystem)
if childtype == 'docker':
cls = DockerSystem
elif childtype == 'vagrant':
cls = VagrantSystem
else:
raise ValueError('Unknown ChildSystem type(%s)' % childtype)
uniqueid = ChildSystem.compute_uniqueid(designation, parentsystem, domain)
return store.load_or_create(cls, designation=designation, _selfjson=str(jsonobj),
_parentsystem=parentsystem, roles=roles, uniqueid=uniqueid)
示例3: find_child_system_from_json
# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import getstore [as 别名]
def find_child_system_from_json(self, jsonobj):
'''Locate the child drone that goes with this JSON - or maybe it's us'''
if 'proxy' in jsonobj:
path = jsonobj['proxy']
if path == 'local/local':
return self
else:
return self
# This works - could be a bit slow if you have lots of child nodes...
q = '''MATCH (drone)<-[:parentsys*]-(child)
WHERE ID(drone) = {id} AND child.childpath = {path}
RETURN child'''
store = Store.getstore(self)
child = store.load_cypher_node(q, GraphNode.factory, {'id': store.id(self), 'path': path})
if child is None:
raise(ValueError('Child system %s from %s [%s] was not found.'
% (path, str(self), str(Store.id(self)))))
return child