コード例 #1
0
 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.
     """
     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()
         burst_service.stop_burst(operation.burst)
         if remove_after_stop:
             current_burst = base.get_from_session(base.KEY_BURST_CONFIG)
             if current_burst and current_burst.id == operation.burst.id:
                 base.remove_from_session(base.KEY_BURST_CONFIG)
             burst_service.remove_burst(operation.burst.id)
         return True
     except Exception, ex:
         self.logger.exception(ex)
         return False
コード例 #2
0
 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()
     base.add2session(base.KEY_BURST_CONFIG, operation.burst)
     raise cherrypy.HTTPRedirect("/burst/")
コード例 #3
0
 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