Closed 3v1n0 closed 10 years ago
You'd really want a separate 'processing' (or tasks) thread to do this, as there are typically a bunch of plots to be done sequentially, followed by an upload. To keep life simple the processing thread wouldn't have access to the data stores, so the files to be plotted would need to be created in the main thread, then their details handed to the processing thread. I like to use queues for this sort of thing, rather than callbacks. The processing thread would just take tasks off the queue one by one, do them, and then sleep when the queue's empty.
Oh, yes... Can be done also like this. Keeping all this stuff into the Tasks thread. But I think it's inconvenient to do all in order as it's done now, since it causes the livedata to be ignored for a while until CPU is ready...
You misunderstand - I'm not suggesting holding everything up while the plots are done (although I don't have a problem with ignoring live data for a minute or two) but you need to make sure you don't try and do half a dozen plots concurrently. So each plot needs to start after the previous one finishes, i.e. a queue.
Ah, sure... Keeping the order was intended.
I'll have a go at doing this, probably in a week or two after the next "release".
I've done a first go at using an uploads queue in commit ff6561. I'll add the 'service' uploads next.
Pywws is meant to be used in low-powered devices, but gnuplot is not.
Right now enabling plots causes pywws to wait the plotter to have finished its task before continuing with its duties, I think it should instead using a thread to detach from gnuplot and using a callback function once completed (i.e. using something like http://stackoverflow.com/a/2581943/210151)
Having the same for network actions would be a plus.