Skip to main content

sessions

Creates, updates, deletes, gets or lists a sessions resource.

Overview

Namesessions
TypeResource
Idgoogle.dataproc.sessions

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The resource name of the session.
createTimestring (google-datetime)Output only. The time when the session was created.
creatorstringOutput only. The email address of the user who created the session.
environmentConfigobjectOptional. Environment configuration for the session execution. (id: EnvironmentConfig)
jupyterSessionobjectOptional. Jupyter session config. (id: JupyterConfig)
labelsobjectOptional. The labels to associate with the session. Label keys must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). Label values may be empty, but, if present, must contain 1 to 63 characters, and must conform to RFC 1035 (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a session.
runtimeConfigobjectOptional. Runtime configuration for the session execution. (id: RuntimeConfig)
runtimeInfoobjectOutput only. Runtime information about session execution. (id: RuntimeInfo)
sessionTemplatestringOptional. The session template used by the session.Only resource names, including project ID and location, are valid.Example: * https://www.googleapis.com/compute/v1/projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id] * projects/[project_id]/locations/[dataproc_region]/sessionTemplates/[template_id]The template must be in the same project and Dataproc region as the session.
sparkConnectSessionobjectOptional. Spark connect session config. (id: SparkConnectConfig)
statestringOutput only. A state of the session.
stateHistoryarrayOutput only. Historical state information for the session.
stateMessagestringOutput only. Session state details, such as the failure description if the state is FAILED.
stateTimestring (google-datetime)Output only. The time when the session entered the current state.
userstringOptional. The email address of the user who owns the session.
uuidstringOutput only. A session UUID (Unique Universal Identifier). The service generates this value when it creates the session.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
projects_locations_sessions_getselectprojectsId, locationsId, sessionsIdGets the resource representation for an interactive session.
projects_locations_sessions_listselectprojectsId, locationsIdpageSize, pageToken, filterLists interactive sessions.
projects_locations_sessions_createinsertprojectsId, locationsIdsessionId, requestIdCreate an interactive session asynchronously.
projects_locations_sessions_deletedeleteprojectsId, locationsId, sessionsIdrequestIdDeletes the interactive session resource. If the session is not in terminal state, it is terminated, and then deleted.
projects_locations_sessions_terminateexecprojectsId, locationsId, sessionsIdTerminates the interactive session.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
sessionsIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
sessionIdstring

SELECT examples

Gets the resource representation for an interactive session.

SELECT
name,
createTime,
creator,
environmentConfig,
jupyterSession,
labels,
runtimeConfig,
runtimeInfo,
sessionTemplate,
sparkConnectSession,
state,
stateHistory,
stateMessage,
stateTime,
user,
uuid
FROM google.dataproc.sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND sessionsId = '{{ sessionsId }}' -- required;

INSERT examples

Create an interactive session asynchronously.

INSERT INTO google.dataproc.sessions (
data__name,
data__jupyterSession,
data__sparkConnectSession,
data__labels,
data__runtimeConfig,
data__environmentConfig,
data__user,
data__sessionTemplate,
projectsId,
locationsId,
sessionId,
requestId
)
SELECT
'{{ name }}',
'{{ jupyterSession }}',
'{{ sparkConnectSession }}',
'{{ labels }}',
'{{ runtimeConfig }}',
'{{ environmentConfig }}',
'{{ user }}',
'{{ sessionTemplate }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ sessionId }}',
'{{ requestId }}'
RETURNING
name,
done,
error,
metadata,
response
;

DELETE examples

Deletes the interactive session resource. If the session is not in terminal state, it is terminated, and then deleted.

DELETE FROM google.dataproc.sessions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
AND requestId = '{{ requestId }}';

Lifecycle Methods

Terminates the interactive session.

EXEC google.dataproc.sessions.projects_locations_sessions_terminate 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@sessionsId='{{ sessionsId }}' --required
@@json=
'{
"requestId": "{{ requestId }}"
}';