Notebook Trigger

The Notebook Trigger will fire a workflow whenever the selected Losant Notebook has completed an execution (either successfully, or with errors).

Notebook Trigger

Node Properties

The trigger only takes one parameter:

Notebook Configuration

A notebook that you previously created. Then, whenever an execution of that notebook completes, the workflow will trigger with the result of that execution.

Payload

{
  "time": <time of the message>,
  "data": {
    "success": < true / false >,
    "notebook": {
      ..information about the notebook...
    },
    "execution": {
      ...information about the particular execution of the notebook...
    }
  },
  "applicationId": <id of the current application>,
  "applicationName": <name of the current application>,
  "triggerId": <id of the notebook>,
  "triggerType": "notebook",
  "flowId": <id of the current workflow>,
  "flowName": <name of the current workflow>,
  "flowVersion": <version of the current workflow>,
  "globals": <object of workflow globals>
}

In addition to the standard workflow payload information, the payload will include an object in the data field, which will include the following properties:

  • success: This will be true if the notebook execution succeeded, and false if the notebook execution failed. If the notebook execution failed, more details can be found in the executionErrors array under the execution object.
  • notebook: This is an object containing all the information about the notebook that was run. It conforms to the Notebook API Schema.
  • execution: This is an object containing all the information about the particular execution of the notebook. It conforms to the Notebook Execution Schema.

For the example workflow above, a specific payload for a triggered workflow might look like this:

{
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "data": {
    "success": true,
    "notebook": {
      "id": "56c74add0d3d350100043380",
      "notebookId": "56c74add0d3d350100043380",
      "applicationId": "568beedeb436ab01007be53d",
      "name": "Your Notebook",
      "creationDate": "2019-03-10T21:04:44.293Z",
      "lastUpdated": "2019-03-12T20:17:49.879Z",
      "jupyterFileName": "yourNotebook.ipynb",
      "jupyterFileUrl": "https://example.com/yourNotebook.ipynb",
      "inputs": [{
        "queryJson": "{ }",
        "dataTableId": "5c9e2e4eab635b000620d17d",
        "inputType": "dataTable",
        "fileName": "example.csv"
      }],
      "outputs": [{
        "outputType":"executionResult",
        "fileName":"result.ipynb"
      }]
    },
    "execution": {
      "id": "5cb53464d0103e0006f34c74",
      "notebookExecutionId": "5cb53464d0103e0006f34c74",
      "notebookId": "56c74add0d3d350100043380",
      "applicationId": "568beedeb436ab01007be53d",
      "outputsCompletedAt": "2019-04-18T18:30:34.368Z",
      "notebookCompletedAt": "2019-04-18T18:30:32.368Z",
      "inputsCompletedAt": "2019-04-18T18:30:31.368Z",
      "runStartedAt": "2019-04-18T18:30:30.368Z",
      "runQueuedAt": "2019-04-18T18:30:29.368Z",
      "maxAllowedRunMinutes": 5,
      "executionRelativeTo": "2019-04-18T18:30:29.368Z",
      "status": "completed",
      "sourceType": "user",
      "sourceId": "58c314ec27f78200017d4ee1",
      "executionErrors": [],
      "inputInfo": {
        "example.csv": {
          "contentType": "text/csv",
          "url": "https://example.com/example.csv",
          "size": 12345
        }
      },
      "outputInfo": {
        "result.ipynb": {
          "url": "https://example.com/result.ipynb",
          "size": 54321
        }
      }
    }
  },
  "applicationId": "568beedeb436ab01007be53d",
  "applicationName": "Equipment Monitor",
  "triggerId": "56c74add0d3d350100043380",
  "triggerType": "notebook",
  "flowId": "56c74add04d0b50100043381",
  "flowName": "Model Trained",
  "flowVersion": "develop",
  "globals": {}
}

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.