[Twisted-Python] dumb question on qt4reactor

Kevin Mcintyre kebin70 at gmail.com
Mon Jul 14 15:11:21 MDT 2014


finalizing - maybe I'm not describing my usage correctly.  I've used
reactor.callLater(0,blah) as a means of starting a unit of work the
by-product of which the caller didn't need.

this is really a case of laying tracks for 2 years not fully comprehending
the train coming down the tracks behind me!  I sorta refused to learn/use
inlinecallbacks or generators and I've never used callInThread until now.
I inserted that into my S3 upload pipeline and it works, simplifying my
code but detaches the caller from reactive failure.

The mechanism you've described is different ~ a callLater to an estimated
point of work completion, maybe a holding pattern if work isn't completed
after the delay, and maybe not a bad means of observation (?)...but yes
disastrous if the callLater function is wired poorly.  Unless I'm
misreading.

Anyway I'm sure my code is illogical since I've was left to my own devices
to solve problems of my own choosing.

The by-product you can see here www.pokertalon.com - a single connection
html5 app.


On Wed, Jul 9, 2014 at 10:51 AM, Kevin Horn <kevin.horn at gmail.com> wrote:

> It might be, but I can't think of a reason off hand why it ever _should_
> be.  I can kind of see how it might work, but if your "async" process ever
> takes longer than your callLater delay it will break, and probably quite
> horribly.
>
>
> On Wed, Jul 9, 2014 at 12:11 PM, Kevin Mcintyre <kebin70 at gmail.com> wrote:
>
>> Another "Oh right" twisted moment.  callInThread instead of callLater?
>>
>> This is a case where I've been laying tracks for 2 years without totally
>> understanding the train that was eventually coming down the tracks.  I
>> guess I implicitly understood by wanting to move to a separate reactor as a
>> separate thread, and in the past when I've used callLater it's encapsulated
>> non-blocking code.
>>
>> In this sense is callLater ever utilized as a pseudo asynchronous method?
>>
>>
>>
>> On Sat, Jul 5, 2014 at 5:24 PM, <exarkun at twistedmatrix.com> wrote:
>>
>>> On 5 Jul, 08:35 pm, kebin70 at gmail.com wrote:
>>>
>>>> calling reactor.callLater within qt4reactor in an attempt to async non
>>>> webkit work but not seeing expected behavior.  Webkit locks while the
>>>> callLater function executes.
>>>>
>>>
>>> `callLater` does not make a blocking function into a non-blocking one.
>>> It just calls a function after a specified delay.  If the function blocks,
>>> then the reactor will block when it gets around to calling it.
>>>
>>> If you need to call blocking APIs you may need to call them in a
>>> separate thread (Twisted includes a threadpool that can help you with this)
>>> or a separate process (Twisted has some APIs for launching and interacting
>>> with other processes, too).  Of course, the ideal solution is often to find
>>> a non-blocking equivalent to the blocking API and use that instead (for
>>> example, I know that txaws is a project that exists - perhaps it can do the
>>> things to S3 that you want to do).
>>>
>>> Jean-Paul
>>>
>>> _______________________________________________
>>> Twisted-Python mailing list
>>> Twisted-Python at twistedmatrix.com
>>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>>
>>
>>
>> _______________________________________________
>> Twisted-Python mailing list
>> Twisted-Python at twistedmatrix.com
>> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>>
>>
>
>
> --
> --
> Kevin Horn
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140714/a33c2235/attachment-0002.html>


More information about the Twisted-Python mailing list