本文整理汇总了Python中tvb.core.services.project_service.ProjectService.get_operation_group_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python ProjectService.get_operation_group_by_id方法的具体用法?Python ProjectService.get_operation_group_by_id怎么用?Python ProjectService.get_operation_group_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tvb.core.services.project_service.ProjectService
的用法示例。
在下文中一共展示了ProjectService.get_operation_group_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stop_burst_operation
# 需要导入模块: from tvb.core.services.project_service import ProjectService [as 别名]
# 或者: from tvb.core.services.project_service.ProjectService import get_operation_group_by_id [as 别名]
def stop_burst_operation(self, operation_id, is_group, remove_after_stop=False):
"""
For a given operation id that is part of a burst just stop the given burst.
:returns True when stopped operation was successfully.
"""
operation_id = int(operation_id)
if int(is_group) == 0:
operation = self.flow_service.load_operation(operation_id)
else:
op_group = ProjectService.get_operation_group_by_id(operation_id)
first_op = ProjectService.get_operations_in_group(op_group)[0]
operation = self.flow_service.load_operation(int(first_op.id))
try:
burst_service = BurstService()
result = burst_service.stop_burst(operation.burst)
if remove_after_stop:
current_burst = common.get_from_session(common.KEY_BURST_CONFIG)
if current_burst and current_burst.id == operation.burst.id:
common.remove_from_session(common.KEY_BURST_CONFIG)
result = burst_service.cancel_or_remove_burst(operation.burst.id) or result
return result
except Exception, ex:
self.logger.exception(ex)
return False
示例2: reload_burst_operation
# 需要导入模块: from tvb.core.services.project_service import ProjectService [as 别名]
# 或者: from tvb.core.services.project_service.ProjectService import get_operation_group_by_id [as 别名]
def reload_burst_operation(self, operation_id, is_group, **_):
"""
Find out from which burst was this operation launched. Set that burst as the selected one and
redirect to the burst page.
"""
is_group = int(is_group)
if not is_group:
operation = self.flow_service.load_operation(int(operation_id))
else:
op_group = ProjectService.get_operation_group_by_id(operation_id)
first_op = ProjectService.get_operations_in_group(op_group)[0]
operation = self.flow_service.load_operation(int(first_op.id))
operation.burst.prepare_after_load()
common.add2session(common.KEY_BURST_CONFIG, operation.burst)
raise cherrypy.HTTPRedirect("/burst/")
示例3: stop_operation
# 需要导入模块: from tvb.core.services.project_service import ProjectService [as 别名]
# 或者: from tvb.core.services.project_service.ProjectService import get_operation_group_by_id [as 别名]
def stop_operation(self, operation_id, is_group, remove_after_stop=False):
"""
Stop the operation given by operation_id. If is_group is true stop all the
operations from that group.
"""
operation_service = OperationService()
result = False
if int(is_group) == 0:
result = operation_service.stop_operation(operation_id)
if remove_after_stop:
ProjectService().remove_operation(operation_id)
else:
op_group = ProjectService.get_operation_group_by_id(operation_id)
operations_in_group = ProjectService.get_operations_in_group(op_group)
for operation in operations_in_group:
tmp_res = operation_service.stop_operation(operation.id)
if remove_after_stop:
ProjectService().remove_operation(operation.id)
result = result or tmp_res
return result