def _send_to_cluster(self, operations, adapter_instance, current_username="******"): """ Initiate operation on cluster""" for operation in operations: try: BACKEND_CLIENT.execute(str(operation.id), current_username, adapter_instance) except Exception, excep: self._handle_exception(excep, {}, "Could not start operation!", operation)
def _send_to_cluster(self, operations, adapter_instance): """ Initiate operation on cluster""" for operation in operations: try: BACKEND_CLIENT.execute(str(operation.id), operation.user.username, adapter_instance) except Exception, excep: self._handle_exception(excep, {}, "Could not connect to the back-end cluster!", operation)
def _send_to_cluster(self, operations, adapter_instance): """ Initiate operation on cluster""" for operation in operations: try: BACKEND_CLIENT.execute(str(operation.id), operation.user.username, adapter_instance) except Exception, excep: excep_msg = "Could not connect to the back-end cluster!" self._handle_exception(excep, {}, excep_msg, operation)
def stop_operation(operation_id, is_group=False, remove_after_stop=False): # type: (int, bool, bool) -> bool """ Stop (also named Cancel) the operation given by operation_id, and potentially also remove it after (with all linked data). In case the Operation has a linked Burst, remove that too. :param operation_id: ID for Operation (or OperationGroup) to be canceled/removed :param is_group: When true stop all the operations from that group. :param remove_after_stop: if True, also remove the operation(s) after stopping :returns True if the stop step was successfully """ result = False if is_group: 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: result = OperationService.stop_operation( operation.id, False, remove_after_stop) or result else: result = BACKEND_CLIENT.stop_operation(operation_id) if remove_after_stop: burst_config = dao.get_burst_for_operation_id(operation_id) ProjectService().remove_operation(operation_id) if burst_config is not None: result = dao.remove_entity(BurstConfiguration, burst_config.id) or result return result
def stop_operation(self, operation_id): """ Stop the operation given by the operation id. """ return BACKEND_CLIENT.stop_operation(int(operation_id))