neural-soupe
neural-soupe
RRunPod
Created by neural-soupe on 4/18/2025 in #⚡|serverless
Run a function once when a worker starts
I have some code that I only want to run once when my serverless worker starts (i.e not everytime a request is made). What is the best way of doing this? Just executing the code outside of the handler?
import runpod
import time

# this code runs once, on startup

time.sleep(10)
print("setup complete")

def handler(event):
# handler code
return {"message": "Hello World"}

runpod.serverless.start({"handler": handler})
import runpod
import time

# this code runs once, on startup

time.sleep(10)
print("setup complete")

def handler(event):
# handler code
return {"message": "Hello World"}

runpod.serverless.start({"handler": handler})
2 replies
RRunPod
Created by neural-soupe on 3/9/2025 in #⚡|serverless
Use SDK to create Network Storage Volumes for Serverless Endpoints
Hello 👋 I am using the SDK to create a serverless endpoint. I know I can specify a volume ID when creating the endpoint via SDK, but is there a way to also programmatically create the network storage volume and push data to it (and then attach it to the endpoint)?
8 replies