Ben Epstein
Ben Epstein
SSolara
Created by Jovan on 1/26/2025 in #questions-issues
Solara server disconnect - settings
@MaartenBreddels I experience the same, the server disconnects after some time and I get the error to reload
5 replies
SSolara
Created by MaartenBreddels on 1/23/2025 in #general
Session life
yea thats fair. So the situation is that i'm deploying this on modal. Modal shuts down containers after some amount of inactivity. But they define inactivity as no incoming requests. Since solara on the "client side" isnt making requests back to the server, the container shuts down. To resolve this, i implemented a slab.task keepalive that pings the solara /readyz endopint every 2 minutes, so long as there is an active user If I don't include that last part, since solara is just always running the task, the modal container never shuts down. So this solution works, its just a little funny
import asyncio

import aiohttp
import solara as sl
import solara.lab as slab

from app.constants import MODAL_LIVE


@slab.task
async def keepalive():
url = "modal-endpoint/readyz"
async with aiohttp.ClientSession() as session:
while True:
try:
sl.get_kernel_id()
async with session.get(url) as response:
response.raise_for_status()
print(f"Successful request to {url}")

except aiohttp.ClientError as e:
print(f"Request failed: {str(e)}")
except RuntimeError:
print("Kernel is no longer alive, allowing shutdown.")
except Exception as e:
print(f"Unexpected error: {str(e)}")

await asyncio.sleep(120)
import asyncio

import aiohttp
import solara as sl
import solara.lab as slab

from app.constants import MODAL_LIVE


@slab.task
async def keepalive():
url = "modal-endpoint/readyz"
async with aiohttp.ClientSession() as session:
while True:
try:
sl.get_kernel_id()
async with session.get(url) as response:
response.raise_for_status()
print(f"Successful request to {url}")

except aiohttp.ClientError as e:
print(f"Request failed: {str(e)}")
except RuntimeError:
print("Kernel is no longer alive, allowing shutdown.")
except Exception as e:
print(f"Unexpected error: {str(e)}")

await asyncio.sleep(120)
4 replies
SSolara
Created by MaartenBreddels on 1/23/2025 in #general
Session life
I'm looking for a way to know if the user has left (closed the tab), or if there are no active sessions
4 replies
SSolara
Created by Elder Millenial on 1/11/2025 in #general
Traitlets
Right but I'm just saying the way you hsve to "retrigger" the change of the variable. Reactive variables don't register updates when they are inplace edits. So just replace
vals.append("foo")
vals.append("foo")
With
vals.value = [*vals.value, "foo"]
vals.value = [*vals.value, "foo"]
Same result, but the second will register
3 replies
SSolara
Created by Elder Millenial on 1/11/2025 in #general
Traitlets
You don't want to modify in place. Set .value my_var.value = deepcopy(the_data) But fwiw I struggled to get Traitlets to behave as I wanted. I made a free database on supabase and have been storing cross-session data, working really well
3 replies
SSolara
Created by Ben Epstein on 12/29/2024 in #general
Am I missing something simple? How do I
I think this would be a good example to add to the documentation, as it's not clear that this would happen
11 replies
SSolara
Created by Ben Epstein on 12/29/2024 in #general
Am I missing something simple? How do I
so * sl.reactive inside component: does not work * sl.reactive outside the component: works * sl.use_reactive inside the component: works
11 replies
SSolara
Created by Ben Epstein on 12/29/2024 in #general
Am I missing something simple? How do I
same thing weirdly.. BUT it does work if I define the reactive outside of hte component
11 replies
SSolara
Created by Ben Epstein on 12/29/2024 in #general
Am I missing something simple? How do I
hhmmm @MaartenBreddels @iisakkirotko it only works if i do sl.use_reactive -- why is that?
11 replies
SSolara
Created by Ben Epstein on 12/28/2024 in #general
@iisakkirotko is there an easy way to
i got it working with some css
3 replies