On 24 July 2018 at 07:19, Andrew Stuart <andrew.stu...@supercoders.com.au> wrote: > I have servers that send a sequence of PNG images which need to be processed > via a sequence of commands. > > My idea is this: > > A Python websockets server is listening for connections from the servers. > When a websocket connection is received, a new Python process is spawned - > presumably using https://docs.python.org/3/library/multiprocessing.html and > somehow the websocket is given to that process (how?). The spawned process > listens to the websocket, receives the PNG images and then processes them. > After completion, the spawned process dies and the websocket is closed. So > the spawned Python processes might run for up to a few minutes each. > > Is this a workable idea in Python? > > One open question is how would I hand the websocket to the spawned process? > > Also, coud such an approach support tens, hundreds, thousands of connections > on a for example 8 core machine with 16 gig RAM ( know this is how long is a > piece of string, but just finger in the air guessing to make sure there’s no > huge gotcha in there that would impose a huge constraint & invalidate the > idea)? > > I was looking at this gist as inspiration for a start point > https://gist.github.com/gdamjan/d7333a4d9069af96fa4d > > Any ideas/feedback valued. >
Is this a batch process - someone uploads all their images at once, and you run the same algorithm on them? I wonder if websockets are a good fit. Normally you'd use them where you have a constant stream of messages or an extremely interactive process. -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement. _______________________________________________ melbourne-pug mailing list melbourne-pug@python.org https://mail.python.org/mailman/listinfo/melbourne-pug