-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AM protocol driver #379
Comments
@habilinour suggestes we could do an on_file plugin to write to AM. |
unable to get python-paramiko on ubuntu 20.04 |
@kurt2x implemented data hub with combo of Sundew and Sarra... he thinks having an AM Sender of some kind would be good. |
@kurt2x likely wants the receiver to act like an amtcpserver connection, where you have a master that forks individual connections using a single port defined for all connections (different from Sundew, where 1 port was assigned to each configuration.) (this might be too much for an initial attempt.)... perhaps just start with a script that accepts a connection and processes bulletins received (separate one for a sender.) |
The AM sender is completed and ready to test. One problem though, Sundew is giving me problems when setting up the test receiver on my Azure VM which has Ubuntu 20.04 installed. There seems to be quite a lot of missing dependencies on |
I spun up a vm to try things out... the following might work:
|
General rule, do apt search python-x to find python library x. If there isn't one, then install with sudo pip install x. |
OK so I sat with @andreleblanc11 yesterday and we pair programmed for a bit. He now has a flowcb plugin that works for accepting messages from a single connection, writing them to a file in a configured directory, and posting a message for the resultant local file. We had to comment out the poll initialization in order to get it to work for our example, because:
dunno... lots of options.. not sure which way to do... so far the most attractive thing to me is to futz with "flow" as an implicit component... |
I'm moving the above discussion to #575 ... as the resolution might be the same... |
So @kurt2x has a long standing wish to have an amserver, like on MetManager, where anyone just connects to a socket, and starts sending data. with Sundew, we never had that, one would just pick a port, and a single process (pxReceiver) would service a single connection on the defined port. What @andreleblanc11 has implemented right now is like pxReceiver, it accepts a single connection and processes it. To get amserver like behaviour, we need to follow the traditional (if obscure) C daemon service pattern (like in http://www.microhowto.info/howto/listen_for_and_accept_tcp_connections_in_c.html#idp58640 ) to recap... what is needed for the amserver "forking" issue:
so... all the instance and log stuff is set up in instance.py ... which calls flow.. so it isn't immediately obvious how to call the instance stuff from a flow... sigh... food for thought. the log setup logic is kind of painful, it's in sarracenia.instance.start() ... I guess we can copy/paste, or might need to re-factor a bit... |
I think copy/paste from instance.start() is probably fine... pidfilename = sarracenia.config.get_pid_filename( ... ) with the right instance number (last argument.) and then write it. a few lines. The logging stuff requires more thought... maybe move it to config? and invoke from there? |
I think we can just fix the pids first, and let them all share the log for now... that will be tangible progress. |
at midnight, it will be hilarious when they all try to rotate the log at once... |
I've been working on the sender problem that me and @petersilva worked on couple of weeks ago. Still can't seem to figure out why the Sundew receiver doesn't like to ingest my source codes' bulletins. There aren't any error messages being replied as well. The receiver just shuts down. I've been verifying the encoding format, and everything seems to be fine (iso-8859-1 is the standard used in my source code and is the same used on Sundew). |
the c recipe for daemons: http://www.microhowto.info/howto/listen_for_and_accept_tcp_connections_in_c.html#idp58640 |
Been talking with @kurt2x this afternoon and here are a couple of key things to point out from our discussion.
|
The stuff being put in the AM header is the ONLY way to separate the bulletins. The AM header gives the length of the message in bytes. and you have to read that many bytes and then stop. Any later bytes are the start of the header of the next message,... If you don't read the right number of bytes... it is hopeless... you will miss the header and I don't think there is any way to re-sync, and AM protocol doesn't have any elements that would allow a re-sync. You need to parse the header correctly, assign the bytes correctly. |
In your test case... you need two canned files instead of just the one you have now. you then send the two files and look at what the am server writes out... if the file it writes out is longer ... then it likely is not paying attention to the length specified in the header. If it's shorter, then it's getting the length wrong. |
Sender and receiver seem to work well together. Bulletins are being stored correctly inside the files. Couple of bugs that have been fixed.
|
looked over the branch. looking good! so far... would be good to add:
for basically if the socket dies, after the close, you want to ebo=1; sleep(ebo) if the reconnect fails then ebo= ebo*2 upto 64 seconds... that way it will only try to re-connect slowly, without spamming the other other end. It also means rather than a try, you need a loop of some kind. You can test by starting the server and sender up, sending a message, then stopping the server, and sending another message... the current code will just give up and die... actually worse... it will consume everything in the queue saying "Message not sent" essentially dropping everything on the ground... really want to be stubborn about sending each message, and not go on to the next if we fail to send one. Once that is done, a PR (vs. v03_wip) would be great! |
also in the sender, the except socket.error.... it does close... and then the routine exits... but the routine is supposed to return True or False. |
The migration of the NCP servers is a big milestone for AM. It should be completed within the next month. The amserver got modified quite a lot to accomodate with generalized bulletin delivery. |
To help with decommissioning Sundew, but not lose interop with MM, then we could make a sender/receiver for AM sockets...
The text was updated successfully, but these errors were encountered: