本文整理匯總了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))