C3 AI Documentation Home

Stop Actions using Action Id

Sometimes, you or your team may start a job that runs for several hours and becomes unresponsive, or is otherwise unable to complete. Unnecessary actions may cause a cluster to become slow or unresponsive. C3 provides a way to target these actions and stop them immediately, based on the action id.

This topic demonstrates step by step instructions on how to terminate an action on a Single Node Environment (SNE) or a Shared Environment.

Interrupt an action on a Single Node Environment

If you are working on an SNE, you can find the action and interrupt it directly.

  1. Open the static console for your environment. Open Chrome Developer Tools to access console commands.

  2. Use the following code snippet to identify all actions on your node.

    JavaScript
    App().actions()

    You may have to expand details for your action to find the specific action to terminate.

  3. Find the id for the action, and use it to specify the action to stop.

    JavaScript
    Js.exec(`Action.forId("ID.NUMBER").interrupt()`)

Interrupt an action on a Shared Environment

Shared Environments have a leader node and task nodes.

  • Interrupting an action on the leader node is the same as interrupting actions on an SNE. See the previous section for more details.

  • Interrupting an action on a task node needs a different console command from the previous section. More specifically, you need to specify which node for the specific action.

    JavaScript
    C3.app().nodes()[1].callJson("Action", "interrupt", C3.app().nodes()[1].callJson("Action", "forId", null, ["ID.NUMBER"]), ["Taking too long to complete"])

Example of interrupting an action on an SNE

This example creates an action using Echo, finds the action, and interrupts it.

  1. Open you application console and open Chrome Developer Tools.

  2. Run Echo.echoStrWithSleep("hi", 1000) to start an action that lasts for 1000 seconds.

  3. You may need to refresh the page for this step, since the Echo action is running. Run App.actions() to find the in progress action. You may need to expand the details of some elements in the array to see the id field to get the ID number.

  4. Use Js.exec(`Action.forId("ID.NUMBER").interrupt()`). Replace ID.NUMBER with the ID number.

Was this page helpful?