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
Beispiel #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()
     common.add2session(common.KEY_BURST_CONFIG, operation.burst)
     raise cherrypy.HTTPRedirect("/burst/")
 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/")
Beispiel #4
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 = OperationService.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 = OperationService.load_operation(int(first_op.id))
        SimulatorController().copy_simulator_configuration(operation.burst.id)

        raise cherrypy.HTTPRedirect("/burst/")
 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
Beispiel #6
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