On Sun, 2008-01-20 at 11:18 +0100, Dirk Meyer wrote:
> A second reason: you always get one parameter for your callback when
> you connect to an InProgress object (the return value or the
> exception). With your proposal it is harder to handle return and
> exception in one function, IMHO it looks st
Dirk Meyer wrote:
> Jason Tackaberry wrote:
>> On Fri, 2008-01-18 at 23:00 +0100, Dirk Meyer wrote:
>>> I added some doc for this. This task should be done in two steps.
>>> First make sure yield_execution always returns an InProgress object
>>> and second add the new Python 2.5 code. I did some ch
Jason Tackaberry wrote:
> On Fri, 2008-01-18 at 23:00 +0100, Dirk Meyer wrote:
>> I added some doc for this. This task should be done in two steps.
>> First make sure yield_execution always returns an InProgress object
>> and second add the new Python 2.5 code. I did some changes and added
>> some
On Fri, 2008-01-18 at 23:00 +0100, Dirk Meyer wrote:
> I added some doc for this. This task should be done in two steps.
> First make sure yield_execution always returns an InProgress object
> and second add the new Python 2.5 code. I did some changes and added
> some doc. I will stop here to discu
Dirk Meyer wrote:
> 6. Add support for foo = yield something in kaa.base.
I added some doc for this. This task should be done in two steps.
First make sure yield_execution always returns an InProgress object
and second add the new Python 2.5 code. I did some changes and added
some doc. I will stop
Dirk Meyer wrote:
> 3. Rename Thread to ThreadCallback and rename start to __call__. A new
>Thread class will inherit from ThreadCallback and add a deprected
>warning and this functions also has a start function with a
>deprected warning.
Done without the Thread wrapper.
> 4. Adjust a
Jason Tackaberry wrote:
> See the attached, which implements it the way I think it should be
> (roughly). I think this is an elegant implementation. I didn't inherit
> ThreadCallback from your BackgroundTask class because I couldn't get it
> to work. You'll see what I mean when I try to make it
Jason Tackaberry wrote:
> See the attached, which implements it the way I think it should be
> (roughly). I think this is an elegant implementation. I didn't inherit
> ThreadCallback from your BackgroundTask class because I couldn't get it
> to work. You'll see what I mean when I try to make it
Jason Tackaberry wrote:
> On 2008-01-18 09:22, Dirk Meyer wrote:
>> One problem with BackgroundTask is that it has signals for completed
>> and exception and the InProgress objects connects to these
>> signals. That does not work with the idea that you can call the
>> callback more than once.
>
> A
On 2008-01-18 09:22, Dirk Meyer wrote:
> One problem with BackgroundTask is that it has signals for completed
> and exception and the InProgress objects connects to these
> signals. That does not work with the idea that you can call the
> callback more than once.
Another was that the decorated fun
Dirk Meyer wrote:
> 1. Adjust all kaa modules and freevo to the new notifier namespace
>stuff. The deprecated warnings in kaa.base will be kept but should
>not be visible for any kaa modules and Freevo 2.0. But since we
>break the API, they will be removed before the next release.
Done
On 2008-01-17 16:16, Dirk Meyer wrote:
> 3. Rename Thread to ThreadCallback and rename start to __call__. A new
>Thread class will inherit from ThreadCallback and add a deprected
>warning and this functions also has a start function with a
>deprected warning.
>
Don't just rename it;
First summary:
I will do the following tomorrow. All API changes will be written down
in base/API_CHANGE.txt.
1. Adjust all kaa modules and freevo to the new notifier namespace
stuff. The deprecated warnings in kaa.base will be kept but should
not be visible for any kaa modules and Freevo 2
Jason Tackaberry wrote:
> On 2008-01-17 15:50, Dirk Meyer wrote:
>> Code using ThreadCallback already has to be renamed because we reuse
>> this name. But I guess it is easy.
>
> Does anything use ThreadCallback directly? My guess is most things just
> use the execute_in_thread decorator.
You are
On 2008-01-17 15:50, Dirk Meyer wrote:
> Code using ThreadCallback already has to be renamed because we reuse
> this name. But I guess it is easy.
Does anything use ThreadCallback directly? My guess is most things just
use the execute_in_thread decorator.
Jason Tackaberry wrote:
> On 2008-01-17 15:47, Dirk Meyer wrote:
>> I think that there is a lot of code using Thread :(
>
> A temporary wrapper should be easy to write. What's one more? :)
Code using ThreadCallback already has to be renamed because we reuse
this name. But I guess it is easy.
Di
On 2008-01-17 15:47, Dirk Meyer wrote:
> I think that there is a lot of code using Thread :(
A temporary wrapper should be easy to write. What's one more? :)
-
This SF.net email is sponsored by: Microsoft
Defy all challenge
Jason Tackaberry wrote:
> On 2008-01-17 15:40, Dirk Meyer wrote:
>> So you suggest s/ThreadCallback/NamedThreadCallback and
>> s/Thread/ThreadCallback? And rename start in Thread to __call__.
>
> I guess that sums it up. What do you think?
I think that there is a lot of code using Thread :(
Disc
On 2008-01-17 15:40, Dirk Meyer wrote:
> So you suggest s/ThreadCallback/NamedThreadCallback and
> s/Thread/ThreadCallback? And rename start in Thread to __call__.
I guess that sums it up. What do you think?
-
This SF.net em
Jason Tackaberry wrote:
> Maybe that's what ThreadCallback should do: run a callback in a new
> thread every time. This obviates the need for the Thread class (it can
> be removed) -- it basically _is_ the Thread class except that it's a
> callable. And we can have a separate class to run a callb
On 2008-01-17 15:26, Dirk Meyer wrote:
> ThreadCallback(object)
>
> MainThreadCallback(ThreadCallback):
> ThreadCallback.__init__('main', ...)
>
> Thread(ThreadCallback):
> ThreadCallback.__init__(None, ...)
>
I wasn't really suggesting this as an implementation (conceding that
MainThre
Jason Tackaberry wrote:
> On 2008-01-17 15:12, Dirk Meyer wrote:
>> What does None do? A thread called None or main?
>
> None will spawn a new thread each time it's called. It won't use
> jobserver. It replicates Thread behavior.
So the code will look like
ThreadCallback(object)
MainThreadCall
On 2008-01-17 15:12, Dirk Meyer wrote:
> What does None do? A thread called None or main?
None will spawn a new thread each time it's called. It won't use
jobserver. It replicates Thread behavior.
-
This SF.net email is sp
On 2008-01-17 15:11, Dirk Meyer wrote:
> Gentoo still uses 2.4 and 2.5 is still masked. I have no idea why they
> still keep it.
Not sure either. It's not like 2.5 is new.
> Python 2.4 is a mimimum because kaa uses decorators at some points and
> you can't install decorated code even if you do n
Jason Tackaberry wrote:
> On 2008-01-17 14:47, Dirk Meyer wrote:
>>> ThreadCallback('name', somefunc)(arguments)
>>
>> What about priority?
>
> Make it a tuple?
>
> ThreadCallback(('name, 10), somefunc)(arguments)
So ('name', 10) start it in name with prio 10, 'name' in name with
default prio.
Jason Tackaberry wrote:
>> Nice. But that would move our target platform to 2.5. Do we want to do
>> that? I agree, it looks much nicer this way.
>
> Well, I wasn't actually suggesting that, but we may want to consider
> it. Here are the facts:
>
>1. Python 2.5 was released in September 2006,
On 2008-01-17 14:47, Dirk Meyer wrote:
>> ThreadCallback('name', somefunc)(arguments)
>
> What about priority?
Make it a tuple?
ThreadCallback(('name, 10), somefunc)(arguments)
or:
ThreadCallback(None, somefunc)(arguments)
-
On 2008-01-17 14:35, Dirk Meyer wrote:
>> But this doesn't work in the case where the decorated function doesn't
>> yield anything but just returns something.
>
> That is ugly anyway.
There is an argument to be made there, granted. You might say that if
the decorated function is not a generator,
Jason Tackaberry wrote:
R> On 2008-01-17 14:30, Dirk Meyer wrote:
>> Please do. Attached a patch that handles ThreadCallback similar to
>> Thread and Process but adds a __call__ method.
>
> So if I understand this correctly, this doesn't work with nameless
> threads? So this doesn't merge ThreadCa
On 2008-01-17 14:30, Dirk Meyer wrote:
> Please do. Attached a patch that handles ThreadCallback similar to
> Thread and Process but adds a __call__ method.
So if I understand this correctly, this doesn't work with nameless
threads? So this doesn't merge ThreadCallback and Thread ...
Also are Th
Jason Tackaberry wrote:
> On 2008-01-17 14:22, Dirk Meyer wrote:
>> I simple way to do this without added extra logic to a Signal is to
>> _not_ call the first next() right now but wait at least one main loop
>> iteration. This will force the return of an InProgress object.
>
> But this doesn't wor
Jason Tackaberry wrote:
> On 2008-01-17 14:06, Dirk Meyer wrote:
>> Yes, conceptually they are the same, but the implentation is a very
>> different. 'main' needs a completly different JobServer. Right now we
>> have MainThreadCallback is a simple class, we would have to greate a
>> MainJobServer t
On 2008-01-17 14:22, Dirk Meyer wrote:
> I simple way to do this without added extra logic to a Signal is to
> _not_ call the first next() right now but wait at least one main loop
> iteration. This will force the return of an InProgress object.
But this doesn't work in the case where the decorate
On 2008-01-17 14:06, Dirk Meyer wrote:
> Yes, conceptually they are the same, but the implentation is a very
> different. 'main' needs a completly different JobServer. Right now we
> have MainThreadCallback is a simple class, we would have to greate a
> MainJobServer to inherit MainThreadCallback f
Jason Tackaberry wrote:
> On 2008-01-17 13:54, Dirk Meyer wrote:
>> This would remove all our 'if isinstance(returnvalue, InProgress)'
>> special cases since we know we always get an InProgress object. This
>> will make the code much simpler. But we should be carefull when using
>> a yield_executio
On 2008-01-17 13:54, Dirk Meyer wrote:
> This would remove all our 'if isinstance(returnvalue, InProgress)'
> special cases since we know we always get an InProgress object. This
> will make the code much simpler. But we should be carefull when using
> a yield_execution inside a yield_execution in
Jason Tackaberry wrote:
> On 2008-01-16 13:12, Dirk Meyer wrote:
>> They do similar things. If you use a Thread, it will be started on
>> start() and do its job. The ThreadCallback gets a thread name to
>> execute it. So when you have 100 functions you want to call in a
>> thread, a Thread will spa
Jason Tackaberry wrote:
> On a related note, I'd like to update the yield_execution() decorator so
> that it returns an InProgress in every case. I recently updated it to
> just return the result if the decorated function doesn't yield anything
> (rather than before where it assumed there was a ne
On 2008-01-17 12:02, Jason Tackaberry wrote:
> cb = kaa.ThreadCallback('thumbnailer', generate_thumbnail)
> cb('file.jpg').connect(handle_thumbnail_done)
>
I still like this API but I see a race condition here: if the thread
executes and completes before connect() is called, handle_thum
On 2008-01-16 13:12, Dirk Meyer wrote:
> They do similar things. If you use a Thread, it will be started on
> start() and do its job. The ThreadCallback gets a thread name to
> execute it. So when you have 100 functions you want to call in a
> thread, a Thread will spawn 100 threads while a ThreadC
Jason Tackaberry wrote:
> As I understand what you wrote, it sounds ok to me. I've never used
> ThreadCallback so I don't know why you would use it over Thread. If
> they basically do the same thing, let's merge them.
They do similar things. If you use a Thread, it will be started on
start() and
On Wed, 2008-01-16 at 12:01 +0100, Dirk Meyer wrote:
> attached a patch how I think a BackgroundTask should look like. I
> added BackgroundTask to async.py and use it in Process and
> Thread. Tell me what you think.
Ok, will have a look some time today.
> On a site-notice: We have Thread() that
Hi Jason and everyone else,
attached a patch how I think a BackgroundTask should look like. I
added BackgroundTask to async.py and use it in Process and
Thread. Tell me what you think.
On a site-notice: We have Thread() that has a start() function. This
class calls a function in a new thread. Thi
43 matches
Mail list logo