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
You can get the POD_ID with ENV variable RUNPOD_POD_ID. Python example below:
Amazing, thanks!
Yep and other pod env variable in the docs
Thanks, I hadn't realised that the Serverless workers share the same env variables as the pods đź‘Ť
Yup I think I that part isn't written on the docs, your welcome