R
RunPod•2mo ago
Jack

What environment variables are available in a serverless worker?

To be clear, this is distinct from the custom environment variables that are set on the template. We want to get the Worker ID from a given serverless worker. This is primarily to improve our logging capability, but it would also be useful to know of any other relevant environment variables exposed in a worker. Note I will be away for the next week so I might take a while to respond.
5 Replies
Encyrption
Encyrption•2mo ago
You can get the POD_ID with ENV variable RUNPOD_POD_ID. Python example below:
POD_ID = os.getenv('RUNPOD_POD_ID')
POD_ID = os.getenv('RUNPOD_POD_ID')
Jack
JackOP•2mo ago
Amazing, thanks!
nerdylive
nerdylive•2mo ago
Yep and other pod env variable in the docs
Jack
JackOP•2mo ago
Thanks, I hadn't realised that the Serverless workers share the same env variables as the pods đź‘Ť
nerdylive
nerdylive•2mo ago
Yup I think I that part isn't written on the docs, your welcome
Want results from more Discord servers?
Add your server