Closed MarkWasfy00 closed 1 year ago
Can you explain in more detail?
Is workerpool capable of keeping the spawn function alive and can the user send input to stdin?
The user can enter inputs in the main process. From the main process you can execute a function in a worker, so you can send information to the worker. However if you have configured multiple workers, you cannot know which of the workers will receive the message, the workers are anonymous.
will it be supported in the future or is not compatible with the current lib main idea? It will be useful to manage persistent concurrent workers that have the ability to make users send inputs to the stdin anyways thank you for your answer
I'm still not sure what you mean. What do you mean with "send inputs to the stdin"?
I'm currently working on an online compiler When the user uses my site he can run for example python script that has this code
x = input("Enter your name: ")
print(f"your name is {x}")
and when the user hits run it will wait for the user to send his input back to the script in the meanwhile, the site can hold a lot of users which is not possible for the server to handle, your library comes in handy and can manage the workers but I can't send back to the worker the user input which he will provide
So you want to run a python script server side? In that case the work is already done in a separate process, so you're not blocking the main thread, so there is probably no need for workerpool
. you can just use an (async) library like spawn-please
or use the bare bone child_process
spawn function.
I want the user to send inputs to the stdin in workerpool How can I achieve that?