Run task on worker creation
Is it possible to make a serverless worker run a custom script on the first startup before its considered "ready"?
29 Replies
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
it cant be when the docker image is built because its specific to the machine
before it goes to that state
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
i mean the gpu
its some optimizations
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
doesnt make sense to put it in the docker image since itll be slightly different for each card
i try to do it while running but it ends up just forwarding the request to the already initialized worker
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
thats what i am currently doing
but the problem is say I require 10 workers
9 of them are initialized already
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
but one of them isnt
and it takes a minute to
im wasting 9 minutes of exeuction time waiting for the one worker that hasnt executed
i make the worker open a websocket connection to my server where it then gets the workload from
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
no none of them are active worker
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
so it takes a minute to run the initialization part
currently what im doing is im getting a worker by sending a /run to the serverless endpoint, with a connection endpoint to my server
when the worker starts up, it checks if its ready or not and runs the script as neccessary
when its done it tells my server its ready
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
yea, i have it that way because i noticed running it through the runpod endpoint is a bit unstable sometimes
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
this issue
https://discord.com/channels/912829806415085598/1261380977544921159
i want to be able to have my worker run a custom script before it is considered ready for requests
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
how?
i want it to run right after the container is started
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
yes
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
it starts the worker to receive requests
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
i will give that a try
You can do this:
Unknown User•15mo ago
Message Not Public
Sign In & Join Server To View
this works great, thanks!