Closed ghost closed 6 years ago
There is no way to do that in osBrain.
In theory, you could pass (a copy of) your current standard input file descriptor to a process (agent) on creation.
However, I do not think that is what you want to do. Agents are running in parallel, so how would you want your system to behave if there are multiple agents waiting for "input" at the same time? Would you want to have them all receive the same input? I am guessing you only have a single terminal to write that input.
If you are simply trying to input random data for testing your system, then I would recommend you to use timers instead, and generate random data for your agents periodically. This would probably mimic your real application better than if you have to manually input some values every time. :blush:
If your "User" agent is a single and unique agent whose only purpose is to read user input and send it to the other agents in the network, then I would rather not make that an agent. Use your "main" script and call input()
in the infinite loop you created.
Thank you for getting back to me so quickly, I did want to make a separate User agent but I think having a simple input in the main script won't interfere much with what I'm trying to do. Thanks for all the suggestions, I will try them out. :)
On Mon, 1 Oct 2018, 11:13 am Miguel Sánchez de León Peque, < notifications@github.com> wrote:
There is no way to do that in osBrain.
In theory, you could pass (a copy of) your current standard input file descriptor to a process (agent) on creation.
However, I do not think that is what you want to do. Agents are running in parallel, so how would you want your system to behave if there are multiple agents waiting for "input" at the same time? Would you want to have them all receive the same input? I am guessing you only have a single terminal to write that input.
If you are simply trying to input random data for testing your system, then I would recommend you to use timers instead https://osbrain.readthedocs.io/en/stable/timers.html, and generate random data for your agents periodically. This would probably mimic your real application better than if you have to manually input some values every time. 😊
If your "User" agent is a single and unique agent whose only purpose is to read user input and send it to the other agents in the network, then I would rather not make that an agent. Use your "main" script and call input() in the infinite loop you created.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/opensistemas-hub/osbrain/issues/313#issuecomment-425799714, or mute the thread https://github.com/notifications/unsubscribe-auth/AQANEHWOTijMbYLphwvrJuEdu0kIzMN2ks5ugbKjgaJpZM4XBNV0 .
I'm somewhat new to python and coding in general so this question might be somewhat stupid but I wanted to know if there is anyway to receive an input for an agent. I've tried doing it myself but receive Eof error everytime. I've pasted my code below.
Everything seems to be working rather well (the code might be a bit ugly though considering my newbish background) except for receiving the input. I'd love some help from people over here.