This is your forum post. Use this space to connect with your audience in a way that’s current and interesting. Post relevant information that will encourage discussion and collaboration. With full freedom to edit posts, as well as add stunning media, managing your forum has never been easier.
Jun 6, 2018
Hello, I've started using a technique for long operations in python and I'd like to know if it seems reasonable in a TD context, or if there are better or more standard ways of doing things.For this application, I have to communicate with three HTTP APIs (including sending files) and use a number of command line programs (a slew of small utilities to control a Fastec camera, and ffmpeg to assemble the camera's output frames into an h264 video file). My general approach so far has been to kick off work in a threading.Thread, then use a Timer CHOP to poll for a result. I use a threading.Lock for memory safety.For the HTTP stuff, this seems to work fine. The use case is pretty simple -- make a sequence of requests in python, and at the end, make sure things turn out OK. I'm using the requests module and write "synchronous" code that then wrapped in a thread.I'm doing something similar with the command-line tools, but I use the subprocess module. The ffmpeg code should be very similar to the http/requests code. The camera controls are a bit more complex, so I'm using a queue.Queue (which is conveniently synchronized) to pass command and response objects. A Timer CHOP calls a poll method that pops things off the queue and reacts accordingly. Please help. I didn't find the right solution from the Internet. References:- https://www.derivative.ca/forum/viewtopic.php?t=11395&p=44185 IT Security animated Video Thanks