Terminate workflow execution.

@param workflowId WorkflowId of the workflow.
@param reason     Reason for terminating the workflow.
16502
@Service
    public void terminateWorkflow(String workflowId, String reason) {
        workflowExecutor.terminateWorkflow(workflowId, reason);
    }
1129216
public void resetCallbacksForInProgressTasks(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.resetWorkflowCallbacks(WorkflowServicePb.ResetWorkflowCallbacksRequest.newBuilder()
                .setWorkflowId(workflowId)
                .build()
        );
    }
617617
def stop(id, reason = '')
      params = { :id => id }
      requires params
      params[:reason] = reason
      DataSift.request(:POST, 'historics/stop', @config, params)
    end
816472
private void terminateSubscriptions(String heapUri, Subscription.CloseReason reason) {
        HeapState state = heapStates.get(heapUri);
        if (state != null) {
            try {
                state.getUpdateLock().lock();
                subTermLock.lock();
                // if someone got here first, don't bother doing the work
                if (!state.isTerminated()) {
                    heapStates.remove(heapUri);
                    heapUris.remove(state.getHeapId());
                    List<IoSession> sessions = state.getSessions();
                    for (IoSession session : sessions) {
                        terminateSubscriptions(session, state, heapUri, reason);
                    }
                    LOGGER.error("Terminating heap state '{}'", heapUri);
                    state.terminate();
                    state.removeListener();
                }
            } finally {
                subTermLock.unlock();
                state.getUpdateLock().unlock();
            }
        }
    }
400261
protected void sendExit(final OtpErlangPid from, final OtpErlangPid dest,
            final OtpErlangObject reason) throws IOException {
        sendExit(exitTag, from, dest, reason);
    }
379474
def delete_workflow(self, workflow_id):
        
        deleted = False

        with switch_db(WorkflowDefinitionModel, "hyperstream"):
            workflows = WorkflowDefinitionModel.objects(workflow_id=workflow_id)
            if len(workflows) == 1:
                workflows[0].delete()
                deleted = True
            else:
                logging.debug("Workflow with id {} does not exist".format(workflow_id))

        with switch_db(WorkflowStatusModel, "hyperstream"):
            workflows = WorkflowStatusModel.objects(workflow_id=workflow_id)
            if len(workflows) == 1:
                workflows[0].delete()
                deleted = True
            else:
                logging.debug("Workflow status with id {} does not exist".format(workflow_id))

        if workflow_id in self.workflows:
            del self.workflows[workflow_id]
            deleted = True

        if deleted:
            logging.info("Deleted workflow with id {}".format(workflow_id))
122460
public synchronized void onRequestFailed(String reason) {
		allRequestsTracker.onRequestFailed(reason);
		recentRequestsTracker.onRequestFailed(reason);
		meter.mark();
	}
753554
public void runDecider(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.decideWorkflow(WorkflowServicePb.DecideWorkflowRequest.newBuilder()
                .setWorkflowId(workflowId)
                .build()
        );
    }
256141
public final void cancel(CancelException reason) {
		if (cancelling != null)
			return;
		if (reason == null) reason = new CancelException("No reason given");
		cancelling = reason;
		if (TaskScheduler.cancel(this)) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
		if (manager.remove(this)) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
		if (status == Task.STATUS_NOT_STARTED) {
			status = Task.STATUS_DONE;
			result.cancelled(reason);
			return;
		}
	}
888635
@Deactivate
    protected synchronized void deactivate(int reason) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Deactivated: " + reason);
        }

        super.deactivate(MY_ALIAS, reason);

        repertoireMap.clear();
        repertoirePIDMap.clear();
        keystoreIdMap.clear();
        keystorePidMap.clear();
        SSLConfigManager.getInstance().clearSSLConfigMap();
        KeyStoreManager.getInstance().clearKSMap();
        AbstractJSSEProvider.clearSSLContextCache();
        processConfig(true);
        this.componentContext = null;

    }
25892
protected void executeAction(Action action) {
        ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
        context.setNodeInstance(this);
        try {
            action.execute(context);
        } catch (Exception e) {
            String exceptionName = e.getClass().getName();
            ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
                resolveContextInstance(ExceptionScope.EXCEPTION_SCOPE, exceptionName);
            if (exceptionScopeInstance == null) {
                throw new WorkflowRuntimeException(this, getProcessInstance(), "Unable to execute Action: " + e.getMessage(), e);
            }
            
            exceptionScopeInstance.handleException(exceptionName, e);
            cancel();
        }
    }
1028759
def Terminate(self, status=None):
    """"""
    try:
      self.queue_manager.DestroyFlowStates(self.session_id)
    except queue_manager.MoreDataException:
      pass

    # This flow might already not be running.
    if not self.IsRunning():
      return

    self._SendTerminationMessage(status=status)

    # Mark as terminated.
    self.context.state = rdf_flow_runner.FlowContext.State.TERMINATED
    self.flow_obj.Flush()
409490
def workflow_close(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/close' % object_id, input_params, always_retry=always_retry, **kwargs)
1214493
public void cancel(Exception reason) {
        // IMPROVEMENT: need to rework how syncs on the future.complete() work. We really should be
        // syncing here, so we don't do the channel.cancel if the request is processing
        // future.complete() on another thread at the same time. Should just do a quick
        // sync, check the future.complete flag, then process only if !complete. That will
        // also mean we can remove a bunch of redundant checks for complete, but we need to check all
        // the paths carefully.
        if (this.channel == null) {
            return;
        }
        synchronized (this.completedSemaphore) {
            if (!this.completed) {
                try {
                    // this ends up calling future.completed()
                    this.channel.cancel(this, reason);
                } catch (Exception e) {
                    // Simply swallow the exception
                } // end try

            } else {
                if (this.channel.readFuture != null) {
                    this.channel.readFuture.setCancelInProgress(0);
                }
                if (this.channel.writeFuture != null) {
                    this.channel.writeFuture.setCancelInProgress(0);
                }
            }
        }
    }
1130120
public void terminateWorkflow(String workflowId, String reason) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.terminateWorkflow(WorkflowServicePb.TerminateWorkflowRequest.newBuilder()
                .setWorkflowId(workflowId)
                .setReason(reason)
                .build()
        );
    }
14564
public void deleteWorkflow(String workflowId, boolean archiveWorkflow) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "Workflow id cannot be blank");

        Object[] params = new Object[]{"archiveWorkflow", archiveWorkflow};
        delete(params, "workflow/{workflowId}/remove", workflowId);
    }
653507
public static void fail(String message, String reason)
  {
    if (message != null && message.length() > 0)
      fail(message + ": " + reason);
    else
      fail(reason);
  }