I have several KJob jobs, some of which may run in parallel, some depend 
on the results of one or more others, and all of them are fallible. The 
context is Akonadi, but I think my question is generic.

I want to retrieve items from several Akonadi collections and act on 
them. By the nature of the (prefered) interface, the individual steps 
executed asynchronously as KJobs.

The parts are these:

I launch several retrieval jobs and want to know when all of them have 
finished. If one of them fails, all others are killed and failure is 
signaled.

As far as I can tell, there's no pre-build way to group jobs in such a 
way as to be notified when all of them have finished. Therefore, 
apparently I need to do the synchronization myself, possibly by 
connecting to each jobs result signal and keeping track of how many are 
still active.

For chaining jobs, I need to glue them together so that the result of 
one is passed as an argument to the next. Of course, if an error occurs, 
the chain ought to be broken.

For all this I can write very specific code -- and do it again the next 
time I want to do something similar. I'd rather not do that. Instead, 
I'd like to connect independent pieces that are ignorant of each other.


It's time for some code. I've given up on the synchronizing and just 
tried some painfully non-generic chaining.

  https://github.com/mschuerig/akonadiexport

I don't like that code at all, but I'm lacking a good idea how to 
improve it.


Michael

-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

Reply via email to