From kde-devel Wed May 04 06:32:05 2011 From: Kevin Krammer Date: Wed, 04 May 2011 06:32:05 +0000 To: kde-devel Subject: Re: KJob: chaining and synchronizing jobs Message-Id: <201105040832.05567.kevin.krammer () gmx ! at> X-MARC-Message: https://marc.info/?l=kde-devel&m=130449078412238 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============0402628517==" --===============0402628517== Content-Type: multipart/signed; boundary="nextPart2778842.2vQkSnFjAp"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart2778842.2vQkSnFjAp Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable On Sunday, 2011-05-01, Michael Schuerig wrote: > 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. >=20 > 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. >=20 > The parts are these: >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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. =46or passing one job's result as a parameter to new job you'll need some p= lace=20 that knows the API of both, gets the data from the finished job and creates= =20 the new job. Maybe using KCompositeJob and reimplementing slotResult()? Cheers, Kevin =2D-=20 Kevin Krammer, KDE developer, xdg-utils developer KDE user support, developer mentoring --nextPart2778842.2vQkSnFjAp Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQBNwPLlnKMhG6pzZJIRAnDdAJ9BmH3Of6bTcXyAq1n/YTremGvkdACeMTCz 0sy4dVEu9DW9nGz+ZeRufCM= =0cOF -----END PGP SIGNATURE----- --nextPart2778842.2vQkSnFjAp-- --===============0402628517== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << --===============0402628517==--