Share via


Run Notebook - Get Snapshot

Get RunNotebook Snapshot for run id.

GET {endpoint}/notebooks/runs/{runId}/snapshot?api-version=2022-03-01-preview

URI Parameters

Name In Required Type Description
endpoint
path True

string (url)

The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net.

runId
path True

string

maxLength: 100

Notebook run id. For Create Run, you can generate a new GUID and use it here. For other actions, this is the same ID used in Create Run.

api-version
query True

string

The Synapse client API Version.

Responses

Name Type Description
200 OK

RunNotebookSnapshotResponse

Ok.

Other Status Codes

CloudError

An error response received from the Azure Synapse service.

Examples

Get Run Notebook Snapshot

Sample request

GET exampleWorkspace.dev.azuresynapse.net/notebooks/runs/4b200abf-c90c-43cf-98ae-b9f2bcf90373/snapshot?api-version=2022-03-01-preview

Sample response

Date: Wed, 10 Mar 2021 07:24:29 GMT
Server: Kestrel Microsoft-HTTPAPI/2.0
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
x-ms-request-id: 393b45f1-a176-4e74-accd-5f66d7f81ec6
{
  "message": "Notebook execution is in Failed state",
  "result": {
    "snapshot": {
      "id": "4b200abf-c90c-43cf-98ae-b9f2bcf90373",
      "notebook": "exampleNotebook",
      "parameters": {
        "param1": {
          "type": "String",
          "value": "Run"
        },
        "param2": {
          "type": "String",
          "value": "Run2"
        }
      },
      "notebookContent": {
        "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleWorkspace/notebooks/exampleNotebook",
        "name": "exampleNotebook",
        "type": "Microsoft.Synapse/workspaces/notebooks",
        "properties": {
          "nbformat": 4,
          "nbformat_minor": 2,
          "bigDataPool": {
            "referenceName": "exampleSparkpool",
            "type": "BigDataPoolReference"
          },
          "sessionProperties": {
            "driverMemory": "56g",
            "driverCores": 8,
            "executorMemory": "56g",
            "executorCores": 8,
            "numExecutors": 2
          },
          "metadata": {
            "language_info": {
              "name": "python",
              "codemirror_mode": null,
              "version": null
            },
            "a365ComputeOptions": {
              "id": "/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.Synapse/workspaces/exampleworkspace/bigDataPools/exampleSparkpool",
              "name": "exampleSparkpool",
              "type": "Spark",
              "endpoint": "https://exampleWorkspace.dev.azuresynapse-dogfood.net/livyApi/versions/2019-11-01-preview/sparkPools/exampleSparkpool",
              "auth": {
                "type": "AAD",
                "authResource": "https://dev.azuresynapse.net"
              },
              "sparkVersion": "2.4",
              "nodeCount": 3,
              "cores": 8,
              "memory": 56,
              "extraHeader": null
            },
            "synapse_widget": {
              "version": "0.1",
              "state": {}
            },
            "kernelspec": {
              "name": "synapse_pyspark",
              "display_name": "python"
            }
          },
          "cells": [
            {
              "cell_type": "code",
              "source": [
                "num = 10"
              ],
              "outputs": [
                {
                  "output_type": "display_data",
                  "data": {
                    "application/vnd.livy.statement-meta+json": {
                      "spark_pool": "exampleSparkpool",
                      "session_id": 1,
                      "statement_id": 1,
                      "state": "finished",
                      "livy_statement_state": "available",
                      "queued_time": "2021-09-06T10:24:57.6453419Z",
                      "session_start_time": "2021-09-06T10:24:57.6941584Z",
                      "execution_start_time": "2021-09-06T10:28:50.1738715Z",
                      "execution_finish_time": "2021-09-06T10:28:50.1739715Z"
                    },
                    "text/plain": "StatementMeta(exampleSparkpool, 1, 1, Finished, Available)"
                  },
                  "metadata": {}
                },
                {
                  "output_type": "execute_result",
                  "execution_count": 1,
                  "data": {
                    "text/plain": ""
                  },
                  "metadata": {}
                }
              ],
              "metadata": {
                "tags": [
                  "parameters"
                ],
                "jupyter": {
                  "source_hidden": false,
                  "outputs_hidden": false
                },
                "nteract": {
                  "transient": {
                    "deleting": false
                  }
                },
                "collapsed": true
              }
            },
            {
              "cell_type": "code",
              "source": [
                "# This cell is generated from runtime parameters. Learn more: https://go.microsoft.com/fwlink/?linkid=2161015\n",
                "param1 = \"Run\"\n",
                "param2 = \"Run2\"\n"
              ],
              "outputs": [
                {
                  "output_type": "display_data",
                  "data": {
                    "application/vnd.livy.statement-meta+json": {
                      "spark_pool": "exampleSparkpool",
                      "session_id": 1,
                      "statement_id": 2,
                      "state": "finished",
                      "livy_statement_state": "available",
                      "queued_time": "2021-09-06T10:24:57.6541813Z",
                      "session_start_time": null,
                      "execution_start_time": "2021-09-06T10:28:50.5257245Z",
                      "execution_finish_time": "2021-09-06T10:28:50.5258235Z"
                    },
                    "text/plain": "StatementMeta(exampleSparkpool, 1, 2, Finished, Available)"
                  },
                  "metadata": {}
                },
                {
                  "output_type": "execute_result",
                  "execution_count": 2,
                  "data": {
                    "text/plain": ""
                  },
                  "metadata": {}
                }
              ],
              "metadata": {
                "tags": [
                  "parameters_overwritten"
                ]
              }
            },
            {
              "cell_type": "code",
              "source": [
                "mssparkutils.notebook.exit(\"SUCCESS_exampleNotebook with num is \" + str(num))"
              ],
              "outputs": [
                {
                  "output_type": "display_data",
                  "data": {
                    "application/vnd.livy.statement-meta+json": {
                      "spark_pool": "exampleSparkpool",
                      "session_id": 1,
                      "statement_id": 3,
                      "state": "finished",
                      "livy_statement_state": "available",
                      "queued_time": "2021-09-06T10:24:57.6615537Z",
                      "session_start_time": null,
                      "execution_start_time": "2021-09-06T10:28:50.8668915Z",
                      "execution_finish_time": "2021-09-06T10:28:51.2691628Z"
                    },
                    "text/plain": "StatementMeta(exampleSparkpool, 1, 3, Finished, Available)"
                  },
                  "metadata": {}
                },
                {
                  "output_type": "display_data",
                  "data": {
                    "text/plain": "ExitValue: SUCCESS_exampleNotebook with num is 10"
                  },
                  "metadata": {}
                }
              ],
              "metadata": {}
            }
          ],
          "folder": null
        },
        "etag": "0f00eb17-0000-3400-0000-60502a1e0000"
      },
      "sparkPool": "exampleSparkpool",
      "sessionId": null,
      "sessionOptions": {
        "kind": null,
        "proxyUser": null,
        "jars": null,
        "pyFiles": null,
        "files": null,
        "driverMemory": "28g",
        "driverCores": 4,
        "executorMemory": "28g",
        "executorCores": 4,
        "numExecutors": 2,
        "archives": null,
        "queue": null,
        "name": null,
        "conf": null,
        "isQueueable": null,
        "heartbeatTimeoutInSecond": null
      },
      "honorSessionTimeToLive": false,
      "exitValue": "SUCCESS_exampleNotebook with num is 10"
    },
    "runId": "e4221395-55ae-4c6d-9756-fae966d84350",
    "runStatus": "Succeeded",
    "sessionId": "1",
    "sparkPool": "exampleSparkpool",
    "lastCheckedOn": "0001-01-01T00:00:00"
  }
}

Definitions

Name Description
BigDataPoolReference

Big data pool reference.

BigDataPoolReferenceType

Big data pool reference type.

CellOutputType

Execution, display, or stream outputs.

CloudError

The object that defines the structure of an Azure Synapse error response.

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

Notebook

Notebook.

NotebookCell

Notebook cell.

NotebookCellOutputItem

An item of the notebook cell execution output.

NotebookKernelSpec

Kernel information.

NotebookLanguageInfo

Language info.

NotebookMetadata

Notebook root-level metadata.

NotebookResource

Notebook resource type.

NotebookSessionProperties

Session properties.

RunNotebookError

Run notebook error.

RunNotebookParameter

Run notebook parameter.

RunNotebookSnapshot

Run notebook snapshot.

RunNotebookSnapshotResponse

Run notebook snapshot response.

RunNotebookSnapshotResult

Run notebook snapshot result.

RunNotebookSparkSessionOptions
SparkConfigurationReference

Spark configuration reference.

SparkConfigurationReferenceType

Spark configuration reference type.

BigDataPoolReference

Big data pool reference.

Name Type Description
referenceName

string

Reference big data pool name.

type

BigDataPoolReferenceType

Big data pool reference type.

BigDataPoolReferenceType

Big data pool reference type.

Value Description
BigDataPoolReference

CellOutputType

Execution, display, or stream outputs.

Value Description
execute_result
display_data
stream
error

CloudError

The object that defines the structure of an Azure Synapse error response.

Name Type Description
error.code

string

Error code.

error.details

CloudError[]

Array with additional error details.

error.message

string

Error message.

error.target

string

Property name/path in request associated with error.

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

Name Type Description
name

string

The name of the folder that this notebook is in.

Notebook

Notebook.

Name Type Description
bigDataPool

BigDataPoolReference

Big data pool reference.

cells

NotebookCell[]

Array of cells of the current notebook.

description

string

The description of the notebook.

folder

Folder

The folder that this notebook is in. If not specified, this notebook will appear at the root level.

metadata

NotebookMetadata

Notebook root-level metadata.

nbformat

integer

Notebook format (major number). Incremented between backwards incompatible changes to the notebook format.

nbformat_minor

integer

Notebook format (minor number). Incremented for backward compatible changes to the notebook format.

sessionProperties

NotebookSessionProperties

Session properties.

targetSparkConfiguration

SparkConfigurationReference

The spark configuration of the spark job.

NotebookCell

Notebook cell.

Name Type Description
attachments

object

Attachments associated with the cell.

cell_type

string

String identifying the type of cell.

metadata

object

Cell-level metadata.

outputs

NotebookCellOutputItem[]

Cell-level output items.

source

string[]

Contents of the cell, represented as an array of lines.

NotebookCellOutputItem

An item of the notebook cell execution output.

Name Type Description
data

object

Output data. Use MIME type as key, and content as value.

execution_count

integer

Execution sequence number.

metadata

object

Metadata for the output item.

name

string

For output_type=stream, determines the name of stream (stdout / stderr).

output_type

CellOutputType

Execution, display, or stream outputs.

text

For output_type=stream, the stream's text output, represented as a string or an array of strings.

NotebookKernelSpec

Kernel information.

Name Type Description
display_name

string

Name to display in UI.

name

string

Name of the kernel specification.

NotebookLanguageInfo

Language info.

Name Type Description
codemirror_mode

string

The codemirror mode to use for code in this language.

name

string

The programming language which this kernel runs.

NotebookMetadata

Notebook root-level metadata.

Name Type Description
kernelspec

NotebookKernelSpec

Kernel information.

language_info

NotebookLanguageInfo

Language info.

NotebookResource

Notebook resource type.

Name Type Description
etag

string

Resource Etag.

id

string

Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

The name of the resource

properties

Notebook

Properties of Notebook.

type

string

The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.

NotebookSessionProperties

Session properties.

Name Type Description
driverCores

integer

Number of cores to use for the driver.

driverMemory

string

Amount of memory to use for the driver process.

executorCores

integer

Number of cores to use for each executor.

executorMemory

string

Amount of memory to use per executor process.

numExecutors

integer

Number of executors to launch for this session.

RunNotebookError

Run notebook error.

Name Type Description
ename

string

Error name.

evalue

string

Error message.

traceback

string[]

Error trace.

RunNotebookParameter

Run notebook parameter.

Name Type Description
type

string

Parameter type.

value

object

Parameter value.

RunNotebookSnapshot

Run notebook snapshot.

Name Type Description
exitValue

string

Output of exit command.

honorSessionTimeToLive

boolean

Whether session should run till time to live after run completes.

id

string

Run notebook runId.

notebook

string

Notebook name.

notebookContent

NotebookResource

Notebook resource type.

parameters

<string,  RunNotebookParameter>

Run notebook parameters

sessionId

string

Livy session id.

sessionOptions

RunNotebookSparkSessionOptions

Session properties.

sparkPool

string

SparkPool name.

RunNotebookSnapshotResponse

Run notebook snapshot response.

Name Type Description
message

string

Response message.

result

RunNotebookSnapshotResult

Run notebook snapshot result.

RunNotebookSnapshotResult

Run notebook snapshot result.

Name Type Description
error

RunNotebookError

Run notebook error.

lastCheckedOn

string

Timestamp of last update.

runId

string

Run id.

runStatus

string

Status of the run notebook.

sessionId

string

Livy session id.

snapshot

RunNotebookSnapshot

Run notebook snapshot.

sparkPool

string

SparkPool name.

RunNotebookSparkSessionOptions

Name Type Description
archives

string[]

Archives to be used in this session

conf

object

Spark configuration properties

driverCores

integer (int32)

Number of cores to use for the driver process

driverMemory

string

Amount of memory to use for the driver process

executorCores

integer (int32)

Number of cores to use for each executor

executorMemory

string

Amount of memory to use per executor process

files

string[]

files to be used in this session

heartbeatTimeoutInSecond

integer (int32)

Timeout in second to which session be orphaned

isQueueable

boolean

Whether to queue session creation if Spark pool doesn't have enough capacity. Default value is true in notebook runs API

jars

string[]

jars to be used in this session

kind

string

The session kind

name

string

The name of this session

numExecutors

integer (int32)

Number of executors to launch for this session

proxyUser

string

User to impersonate when starting the session

pyFiles

string[]

Python files to be used in this session

queue

object

The name of the YARN queue to which submitted

tags

object

SparkConfigurationReference

Spark configuration reference.

Name Type Description
referenceName

string

Reference spark configuration name.

type

SparkConfigurationReferenceType

Spark configuration reference type.

SparkConfigurationReferenceType

Spark configuration reference type.

Value Description
SparkConfigurationReference