本文整理汇总了Python中mixgene.redis_helper.ExpKeys.get_scope_key方法的典型用法代码示例。如果您正苦于以下问题:Python ExpKeys.get_scope_key方法的具体用法?Python ExpKeys.get_scope_key怎么用?Python ExpKeys.get_scope_key使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mixgene.redis_helper.ExpKeys
的用法示例。
在下文中一共展示了ExpKeys.get_scope_key方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: store
# 需要导入模块: from mixgene.redis_helper import ExpKeys [as 别名]
# 或者: from mixgene.redis_helper.ExpKeys import get_scope_key [as 别名]
def store(self, redis_instance=None):
if redis_instance is None:
r = get_redis_instance()
else:
r = redis_instance
key = ExpKeys.get_scope_key(self.exp.pk, scope_name=self.name)
r.set(key, pickle.dumps(self.scope_vars))
log.debug("Scope `%s` was saved to storage", self.name)
示例2: load
# 需要导入模块: from mixgene.redis_helper import ExpKeys [as 别名]
# 或者: from mixgene.redis_helper.ExpKeys import get_scope_key [as 别名]
def load(self, redis_instance=None):
if redis_instance is None:
r = get_redis_instance()
else:
r = redis_instance
key = ExpKeys.get_scope_key(self.exp.pk, scope_name=self.name)
raw = r.get(key)
if raw is not None:
self.scope_vars = pickle.loads(raw)
# TODO: set scope name during scope_var creation
for scope_var in self.scope_vars:
scope_var.scope_name = self.name
示例3: post_init
# 需要导入模块: from mixgene.redis_helper import ExpKeys [as 别名]
# 或者: from mixgene.redis_helper.ExpKeys import get_scope_key [as 别名]
def post_init(self, redis_instance=None):
## TODO: RENAME TO init experiment and invoke on first save
if redis_instance is None:
r = get_redis_instance()
else:
r = redis_instance
pipe = r.pipeline()
pipe.hset(ExpKeys.get_scope_creating_block_uuid_keys(self.pk), "root", None)
pipe.sadd(ExpKeys.get_all_exp_keys_key(self.pk),[
ExpKeys.get_exp_blocks_list_key(self.pk),
ExpKeys.get_blocks_uuid_by_alias(self.pk),
ExpKeys.get_scope_creating_block_uuid_keys(self.pk),
ExpKeys.get_scope_key(self.pk, "root")
])
pipe.execute()
示例4: load
# 需要导入模块: from mixgene.redis_helper import ExpKeys [as 别名]
# 或者: from mixgene.redis_helper.ExpKeys import get_scope_key [as 别名]
def load(self, redis_instance=None):
if redis_instance is None:
r = get_redis_instance()
else:
r = redis_instance
key = ExpKeys.get_scope_key(self.exp.pk, scope_name=self.name)
raw = r.get(key)
if raw is not None:
vars_p = pickle.loads(raw)
if isinstance(vars_p, list):
self.scope_vars = vars_p[0]
self.temp_vars = dict()
elif isinstance(vars_p, set):
self.scope_vars = vars_p
self.load_temp()
if isinstance(self.temp_vars, list):
self.temp_vars = dict()
# TODO: set scope name during scope_var creation
for scope_var in self.scope_vars:
scope_var.scope_name = self.name