本文整理汇总了Python中cm.services.ServiceRole.from_string_array方法的典型用法代码示例。如果您正苦于以下问题:Python ServiceRole.from_string_array方法的具体用法?Python ServiceRole.from_string_array怎么用?Python ServiceRole.from_string_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cm.services.ServiceRole
的用法示例。
在下文中一共展示了ServiceRole.from_string_array方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _update_user_data
# 需要导入模块: from cm.services import ServiceRole [as 别名]
# 或者: from cm.services.ServiceRole import from_string_array [as 别名]
def _update_user_data(self):
if 'filesystems' in self.app.ud:
old_fs_list = self.app.ud.get('filesystems') or []
new_fs_list = []
# clear 'services' and replace with the new format
for fs in old_fs_list:
svc_roles = ServiceRole.from_string_array(fs['roles'])
if ServiceRole.GALAXY_TOOLS in svc_roles and ServiceRole.GALAXY_DATA in svc_roles:
# This condition should only occur in new configs, but check
# added so that things work properly even if run against a new config
# Only works for default configs though...
new_fs_list.append(fs)
elif ServiceRole.GALAXY_TOOLS in svc_roles:
pass # skip adding the galaxy tools file system, no longer needed.
else:
if ServiceRole.GALAXY_DATA in ServiceRole.from_string_array(fs['roles']):
fs['roles'] = ServiceRole.to_string_array([ServiceRole.GALAXY_TOOLS,
ServiceRole.GALAXY_DATA])
new_fs_list.append(fs)
else:
new_fs_list.append(fs)
self.app.ud['filesystems'] = new_fs_list
self.app.ud['deployment_version'] = 2
self.app.ud.pop('galaxy_home', None) # TODO: Galaxy home is always reset
# to default. Discuss implications
return True
示例2: __init__
# 需要导入模块: from cm.services import ServiceRole [as 别名]
# 或者: from cm.services.ServiceRole import from_string_array [as 别名]
def __init__(self, app):
super(MigrationService, self).__init__(app)
self.svc_roles = [ServiceRole.MIGRATION]
self.name = ServiceRole.to_string(ServiceRole.MIGRATION)
self.dependencies = []
if 'filesystems' in self.app.ud:
for fs in self.app.ud.get('filesystems') or []:
# Wait for galaxy data, indices and tools to come up before attempting migration
if ServiceRole.GALAXY_DATA in ServiceRole.from_string_array(fs['roles']):
self.dependencies.append(ServiceDependency(self, ServiceRole.GALAXY_DATA))
if ServiceRole.GALAXY_TOOLS in ServiceRole.from_string_array(fs['roles']):
self.dependencies.append(ServiceDependency(self, ServiceRole.GALAXY_TOOLS))
if ServiceRole.GALAXY_INDICES in ServiceRole.from_string_array(fs['roles']):
self.dependencies.append(ServiceDependency(self, ServiceRole.GALAXY_INDICES))