Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/docs/source/src/python/polars-cloud/reconnect.py
8336 views
1
"""
2
import polars as pl
3
import polars_cloud as pc
4
5
# --8<-- [start:manifest]
6
ctx = pc.ComputeContext(workspace="your-workspace", cpus=4, memory=16)
7
ctx.register("ManifestName")
8
9
# On another process / machine
10
ctx = pc.ComputeContext(workspace="your-workspace", name="ManifestName")
11
ctx.start()
12
13
# --8<-- [end:manifest]
14
15
# --8<-- [start:setup]
16
ctx = pc.ComputeContext(workspace="your-workspace", cpus=4, memory=16)
17
18
ctx.start()
19
# --8<-- [end:setup]
20
21
# --8<-- [start:print]
22
print(ctx)
23
# --8<-- [end:print]
24
25
# --8<-- [start:connect_id]
26
ctx = pc.ComputeContext.connect('0198e107-xxxx-xxxx-xxxx-xxxxxxxxxxxx')
27
28
# --8<-- [end:connect_id]
29
30
# --8<-- [start:select]
31
# Interactive interface to select the compute cluster you want to (re)connect to
32
ctx = pc.ComputeContext.select()
33
# --8<-- [end:select]
34
35
# --8<-- [start:via_workspace]
36
# List all clusters in the specified workspace
37
pc.ComputeContext.list('your-workspace-name')
38
# --8<-- [end:via_workspace]
39
"""
40
41