Skip to content

Commit 4f484f9

Browse files
Merge pull request #10847 from soerenreichardt/session-management-procs-documentation
Document explicit session management
2 parents e7a2305 + 5356d22 commit 4f484f9

File tree

2 files changed

+169
-8
lines changed

2 files changed

+169
-8
lines changed

doc/modules/ROOT/pages/installation/aura-graph-analytics-serverless.adoc

Lines changed: 168 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Instead, a GDS Session is started on-demand to perform GDS computations.
2222
There are two primary APIs for working with GDS Sessions: the GDS Python Client and the GDS Session Cypher API.
2323

2424

25+
[[gds-python-client]]
2526
=== GDS Python Client
2627

2728
Using the client, it is possible to perform all operations on a GDS Session.
@@ -48,18 +49,11 @@ A good place to start are the Tutorials:
4849
This manual covers all aspects of the GDS Session Cypher API.
4950
The Cypher API supports remote projections, calling algorithms and machine learning operations, and remote write back to the AuraDB instance.
5051
It is currently offered only for AuraDB and is used from within a Cypher query context, such as Query in the Aura Console.
51-
This means that the session is created automatically when a remote graph projection runs, and deleted automatically when the graph is dropped.
5252

5353
In the following sections we will focus only on the GDS Session Cypher API, assuming that it is used from an AuraDB instance.
5454

5555

56-
== Session lifecycle and configuration
57-
58-
In the Cypher API, sessions are managed _implicitly_.
59-
That means that there is no operation to create or delete a session.
60-
Instead, a session is created when a remote projection is run, and deleted when the graph is dropped.
61-
Sessions cannot be listed directly, but _graphs_ can be listed using `gds.graph.list()`.
62-
56+
== Session configuration
6357

6458
=== Session size
6559

@@ -96,6 +90,172 @@ Even if the session does not expire due to inactivity, it will still expire 7 da
9690
This is a hard limit and cannot be changed.
9791

9892

93+
== Session management and lifecycle
94+
95+
In the Cypher API, sessions can be managed in two different ways:
96+
. <<implicit-session-management,Implicitly>>
97+
. <<explicit-session-management,Explicitly>>
98+
99+
The implicit session management is the default way of working with GDS Sessions in the Cypher API.
100+
After a session is created and the graph is projected, both options are identical in the use of GDS algorithms.
101+
102+
[[implicit-session-management]]
103+
=== Implicit session management
104+
105+
In the implicit managed sessions option, a GDS Session is created automatically when a remote projection is run, and deleted when the graph is dropped.
106+
Sessions can still be listed and dropped via the corresponding <<session-management-procedures,session management procedures>>.
107+
In the case where additional graphs are projected into the same session, for example via xref:management-ops/graph-creation/graph-filter.adoc[graph filtering], the session will not be deleted until all graphs are dropped.
108+
109+
110+
[[explicit-session-management]]
111+
=== Explicit session management
112+
113+
In the explicit managed sessions option, a GDS Session has to be created explicitly before executing any projection using the <<session-create-procedure,`gds.session.getOrCreate`>> procedure. To project a graph onto the created GDS Session, the `id` column of the <<session-create-procedure-results,procedure result table>> must be passed as the `gds.graph.project` functions's `sessionId` xref:management-ops/graph-creation/graph-project-cypher-projection.adoc#graph-project-cypher-projection-syntax-configuration[configuration parameter].
114+
115+
116+
[[session-management-procedures]]
117+
== Session management procedures
118+
119+
The session management procedures allow to explicitly manage GDS Sessions without having to project a graph. They allow to list and delete existing sessions, or create new sessions and are designed to mimic the workflow of the <<gds-python-client, GDS Python Client>>.
120+
121+
122+
[[session-create-procedure]]
123+
=== Creating sessions
124+
125+
Calling the `gds.session.getOrCreate` procedure will trigger the creation of a GDS Session based on the specified procedure parameters if no other session with the given name an configuration already exists. If such a session already exists, that session will be returned instead.
126+
127+
128+
==== Syntax
129+
130+
[source, cypher]
131+
----
132+
CALL gds.session.getOrCreate(
133+
sessionName: String,
134+
memory: String,
135+
ttl: Duration
136+
cloudLocation: Map
137+
) YIELD
138+
id: String,
139+
name: String,
140+
auraInstanceId: String,
141+
memory: String,
142+
status: String,
143+
creationTime: Datetime,
144+
host: String,
145+
expiryDate: Datetime,
146+
ttl: TemporalAmount,
147+
errorMessage: String
148+
----
149+
150+
.Parameters
151+
[opts="header",cols="1,1,1,4"]
152+
|===
153+
| Name | Type | Optional | Description
154+
| sessionName | String | no | The name of the GDS Session to create or return.
155+
| memory | String | no | The size of the GDS Session, e.g. `4GB`, `8GB`, etc.
156+
| ttl | Duration | yes | The time to live of the GDS Session when no activity is recorded, e.g. `duration({days: 1})`, `duration({hours: 12})`, etc. The default value is 2 days.
157+
|===
158+
159+
[[session-create-procedure-results]]
160+
.Results
161+
[opts="header",cols="3m,1,6"]
162+
|===
163+
| Name | Type | Description
164+
| id | String | The unique identifier of the GDS Session.
165+
| name | String | The name of the GDS Session.
166+
| auraInstanceId | String | The Aura instance ID to which the GDS Session is attached to.
167+
| memory | String | The size of the GDS Session, e.g. `4GB`, `8GB`, etc.
168+
| status | String | The status of the GDS Session, e.g. `Creating`, `Ready`, `Expired`, etc.
169+
| creationTime | Datetime | The time when the GDS Session was created.
170+
| host | String | The public host address of the GDS Session.
171+
| expiryDate | Datetime | The time when the GDS Session will definitely expire.
172+
| ttl | TemporalAmount | The time that is left until the GDS Session expires due to inactivity.
173+
| errorMessage | String | The error message, if the GDS Session could not be created or is in an unhealthy state.
174+
|===
175+
176+
177+
=== Listing sessions
178+
179+
Calling the `gds.session.list` procedure will return GDS Sessions that are available to the current aura user.
180+
181+
182+
==== Syntax
183+
184+
[source, cypher]
185+
----
186+
CALL gds.session.list(
187+
projectId: String,
188+
filterAuraInstanceId: boolean
189+
) YIELD
190+
id: String,
191+
name: String,
192+
auraInstanceId: String,
193+
memory: String,
194+
status: String,
195+
creationTime: Datetime,
196+
host: String,
197+
expiryDate: Datetime,
198+
ttl: TemporalAmount,
199+
errorMessage: String
200+
----
201+
202+
.Parameters
203+
[opts="header",cols="1,1,1,1,4"]
204+
|===
205+
| Name | Type | Optional | Default | Description
206+
| projectId | String | yes | "" | The ID of the project to which the GDS Sessions belong. If not specified, all sessions of the aura user are returned.
207+
| filterAuraInstance | String | yes | false | If set to `true`, only sessions that are attached to current Aura instance are returned. If not specified, all sessions of the aura user are returned.
208+
|===
209+
210+
.Results
211+
[opts="header",cols="3m,1,6"]
212+
|===
213+
| Name | Type | Description
214+
| id | String | The unique identifier of the GDS Session.
215+
| name | String | The name of the GDS Session.
216+
| auraInstanceId | String | The Aura instance ID to which the GDS Session is attached to.
217+
| memory | String | The size of the GDS Session, e.g. `4GB`, `8GB`, etc.
218+
| status | String | The status of the GDS Session, e.g. `Creating`, `Ready`, `Expired`, etc.
219+
| creationTime | Datetime | The time when the GDS Session was created.
220+
| host | String | The public host address of the GDS Session.
221+
| expiryDate | Datetime | The time when the GDS Session will definitely expire.
222+
| ttl | TemporalAmount | The time that is left until the GDS Session expires due to inactivity.
223+
| errorMessage | String | The error message, if the GDS Session could not be created or is in an unhealthy state.
224+
|===
225+
226+
227+
=== Deleting sessions
228+
229+
Calling the `gds.session.delete` procedure will delete a GDS Session with the given ID. If the session is not found, an error is raised.
230+
231+
232+
==== Syntax
233+
234+
[source, cypher]
235+
----
236+
CALL gds.session.delete(
237+
name: String,
238+
projectId: String
239+
) YIELD
240+
deleted: boolean
241+
----
242+
243+
.Parameters
244+
[opts="header",cols="1,1,1,1,4"]
245+
|===
246+
| Name | Type | Optional | Default | Description
247+
| name | String | no | n/a | The name of the GDS Session to delete.
248+
| projectId | String | yes | "" | The ID of the project to which the GDS Session belongs. If similar sessions exist in different projects an error is thrown that indicates to provide a project ID.
249+
|===
250+
251+
.Results
252+
[opts="header",cols="1,1,6"]
253+
|===
254+
| Name | Type | Description
255+
| deleted | Boolean | True, if the GDS Session was successfully deleted, false otherwise.
256+
|===
257+
258+
99259
== Syntax
100260

101261
The GDS Session Cypher API matches the GDS plugin API as closely as possible.

doc/modules/ROOT/pages/management-ops/graph-creation/graph-project-cypher-projection.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ include::partial$/management-ops/common-read-configuration.adoc[]
111111
| inverseIndexedRelationshipTypes | List of String | [] | yes | Declare a number of relationship types which will also be indexed in inverse direction. `*` can be used to declare all relationship types as inverse indexed.
112112
| memory label:serverless[Aura Graph Analytics Serverless] | String | - | no footnote:serverless[Only required for xref:installation/aura-graph-analytics-serverless.adoc[] ] | Declare the memory used for the xref:installation/aura-graph-analytics-serverless.adoc[GDS Session] created for the projected graph.
113113
| ttl label:serverless[Aura Graph Analytics Serverless] | Duration | PT1H | yes | Declare the time to live before the xref:installation/aura-graph-analytics-serverless.adoc[GDS Session] created for the projected graph expires due to inactivity.
114+
| sessionId label:serverless[Aura Graph Analytics Serverless] | String | - | no footnote:serverless[Only required for xref:installation/aura-graph-analytics-serverless.adoc[] ] | The ID of the xref:installation/aura-graph-analytics-serverless.adoc[GDS Session] the graph should be projected on.
114115
| batchSize label:serverless[Aura Graph Analytics Serverless] | Integer | 10000 | yes | Size of batches transmitted from the DBMS to the session. Lower the value to reduce the memory usage on the DBMS side. Increase the value to send fewer batches to the GDS Session.
115116
|===
116117

0 commit comments

Comments
 (0)