Spark Session - Create Spark Session

建立新的Spark會話。

POST {endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}/sessions
POST {endpoint}/livyApi/versions/{livyApiVersion}/sparkPools/{sparkPoolName}/sessions?detailed={detailed}

URI 參數

名稱 位於 必要 類型 Description
endpoint
path True

string

工作區開發端點,例如 https://myworkspace.dev.azuresynapse.net。

livyApiVersion
path True

string

要求的有效 API 版本。

sparkPoolName
path True

string

Spark 集區的名稱。

detailed
query

boolean

選擇性查詢參數,指定詳細回應是否傳回超過一般 livy。

要求本文

名稱 必要 類型 Description
name True

string

archives

string[]

args

string[]

artifactId

string

className

string

conf

object

driverCores

integer (int32)

driverMemory

string

executorCores

integer (int32)

executorMemory

string

file

string

files

string[]

jars

string[]

numExecutors

integer (int32)

pyFiles

string[]

tags

object

回覆

名稱 類型 Description
200 OK

SparkSession

成功

範例

Create new spark session.

範例要求

POST myWorkspace.dev.azuresynapse.net/livyApi/versions/2019-11-01-preview/sparkPools/mySparkPool/sessions?detailed=True

{
  "tags": null,
  "artifactId": "fill in here",
  "name": "jobname",
  "file": "abfss://",
  "className": "classname",
  "args": [],
  "jars": [],
  "files": [],
  "archives": [],
  "conf": null,
  "driverMemory": "4g",
  "driverCores": 4,
  "executorMemory": "2g",
  "executorCores": 2,
  "numExecutors": 2
}

範例回覆

{
  "livyInfo": null,
  "name": "jobname",
  "workspaceName": "myWorkspace",
  "sparkPoolName": "mySparkPool",
  "submitterName": "thetime",
  "submitterId": "thesubmitterid",
  "artifactId": "fill in here",
  "jobType": "SparkSession",
  "result": "Failed",
  "schedulerInfo": null,
  "pluginInfo": null,
  "errorInfo": [],
  "tags": null,
  "id": 1,
  "appId": "fill in here",
  "appInfo": null,
  "state": "the state",
  "log": []
}

定義

名稱 Description
LivyStates

批次狀態

PluginCurrentState
SchedulerCurrentState
SparkErrorSource
SparkJobType

作業類型。

SparkRequest
SparkScheduler
SparkServiceError
SparkServicePlugin
SparkSession
SparkSessionOptions
SparkSessionResultType
SparkSessionState

LivyStates

批次狀態

值 Description
not_started
starting
idle
busy
shutting_down
error
dead
killed
success
running
recovering

PluginCurrentState

值 Description
Preparation
ResourceAcquisition
Queued
Submission
Monitoring
Cleanup
Ended

SchedulerCurrentState

值 Description
Queued
Scheduled
Ended

SparkErrorSource

值 Description
System
User
Unknown
Dependency

SparkJobType

作業類型。

值 Description
SparkBatch
SparkSession

SparkRequest

名稱 類型 Description
archives

string[]

args

string[]

className

string

conf

object

driverCores

integer (int32)

driverMemory

string

executorCores

integer (int32)

executorMemory

string

file

string

files

string[]

jars

string[]

name

string

numExecutors

integer (int32)

pyFiles

string[]

SparkScheduler

名稱 類型 Description
cancellationRequestedAt

string (date-time)

currentState

SchedulerCurrentState

endedAt

string (date-time)

scheduledAt

string (date-time)

submittedAt

string (date-time)

SparkServiceError

名稱 類型 Description
errorCode

string

message

string

source

SparkErrorSource

SparkServicePlugin

名稱 類型 Description
cleanupStartedAt

string (date-time)

currentState

PluginCurrentState

monitoringStartedAt

string (date-time)

preparationStartedAt

string (date-time)

resourceAcquisitionStartedAt

string (date-time)

submissionStartedAt

string (date-time)

SparkSession

名稱 類型 Description
appId

string

appInfo

object

artifactId

string

errorInfo

SparkServiceError[]

id

integer (int32)

jobType

SparkJobType

livyInfo

SparkSessionState

log

string[]

name

string

pluginInfo

SparkServicePlugin

result

SparkSessionResultType

schedulerInfo

SparkScheduler

sparkPoolName

string

state

LivyStates

會話狀態。

submitterId

string

submitterName

string

tags

object

workspaceName

string

SparkSessionOptions

名稱 類型 Description
archives

string[]

args

string[]

artifactId

string

className

string

conf

object

driverCores

integer (int32)

driverMemory

string

executorCores

integer (int32)

executorMemory

string

file

string

files

string[]

jars

string[]

name

string

numExecutors

integer (int32)

pyFiles

string[]

tags

object

SparkSessionResultType

值 Description
Uncertain
Succeeded
Failed
Cancelled

SparkSessionState

名稱 類型 Description
busyAt

string (date-time)

currentState

string

deadAt

string (date-time)

errorAt

string (date-time)

idleAt

string (date-time)

jobCreationRequest

SparkRequest

killedAt

string (date-time)

notStartedAt

string (date-time)

recoveringAt

string (date-time)

shuttingDownAt

string (date-time)

startingAt

string (date-time)