Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 06-21-2011, 05:32 AM   #91
meme
Sigil developer
meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.meme ought to be getting tired of karma fortunes by now.
 
Posts: 1,275
Karma: 1101600
Join Date: Jan 2011
Location: UK
Device: Kindle PW, K4 NT, K3, Kobo Touch
The new finish statements show that the jobs are starting/completing in the right order which matches what was observed, so all looks well.

Using the current code in the plugin:
Code:
self.gui.device_manager.get_device_information(FunctionDispatcher(self.gui.info_read))
works ok:
Code:
Job: 1 Get device information started
DeviceJob: 1 Get device information done, calling callback
DeviceJob: 1 Get device information callback returned
Job: 2 Get list of books on device started
Job: 1 Get device information finished
DeviceJob: 2 Get list of books on device done, calling callback
DeviceJob: 2 Get list of books on device callback returned
Job: 3 Upload 5 books to device:... started
Job: 2 Get list of books on device finished
DeviceJob: 3 Upload 5 books to device:... done, calling callback
DeviceJob: 3 Upload 5 books to device:... callback returned
Job: 6 Send metadata to device started
Job: 3 Upload 5 books to device:... finished
DeviceJob: 6 Send metadata to device done, calling callback
DeviceJob: 6 Send metadata to device callback returned
Job: 4 Create Kindle Collections started
Job: 6 Send metadata to device finished
DeviceJob: 4 Create Kindle Collections done, calling callback
DeviceJob: 4 Create Kindle Collections callback returned
Job: 5 Get device information started
DeviceJob: 5 Get device information done, calling callback
DeviceJob: 5 Get device information callback returned
Job: 7 Get list of books on device started
Job: 4 Create Kindle Collections finished
Job: 5 Get device information finished
DeviceJob: 7 Get list of books on device done, calling callback
DeviceJob: 7 Get list of books on device callback returned
Job: 7 Get list of books on device finished
If I modify the code to use device_manager.books (as chaley asked in point 2):
Code:
self.gui.device_manager.books(FunctionDispatcher(self.gui.metadata_downloaded))
it also seems to work ok, although without calling the get device information (which isn't needed by my code but does no harm).
Code:
Job: 1 Get device information started
DeviceJob: 1 Get device information done, calling callback
DeviceJob: 1 Get device information callback returned
Job: 2 Get list of books on device started
Job: 1 Get device information finished
DeviceJob: 2 Get list of books on device done, calling callback
DeviceJob: 2 Get list of books on device callback returned
Job: 3 Upload 5 books to device:Life, the Universe and Everything, So Long, and Thanks For All the Fish, Mostly Harmless, The Hitchhiker’s_Guide_to the Galaxy, The_Restaurant_at the End of the Universe started
Job: 2 Get list of books on device finished
DeviceJob: 3 Upload 5 books to device:Life, the Universe and Everything, So Long, and Thanks For All the Fish, Mostly Harmless, The Hitchhiker’s_Guide_to the Galaxy, The_Restaurant_at the End of the Universe done, calling callback
DeviceJob: 3 Upload 5 books to device:Life, the Universe and Everything, So Long, and Thanks For All the Fish, Mostly Harmless, The Hitchhiker’s_Guide_to the Galaxy, The_Restaurant_at the End of the Universe callback returned
Job: 6 Send metadata to device started
Job: 3 Upload 5 books to device:Life, the Universe and Everything, So Long, and Thanks For All the Fish, Mostly Harmless, The Hitchhiker’s_Guide_to the Galaxy, The_Restaurant_at the End of the Universe finished
DeviceJob: 6 Send metadata to device done, calling callback
DeviceJob: 6 Send metadata to device callback returned
Job: 4 Create Kindle Collections started
Job: 6 Send metadata to device finished
DeviceJob: 4 Create Kindle Collections done, calling callback
DeviceJob: 4 Create Kindle Collections callback returned
Job: 5 Get list of books on device started
Job: 4 Create Kindle Collections finished
DeviceJob: 5 Get list of books on device done, calling callback
DeviceJob: 5 Get list of books on device callback returned
Job: 5 Get list of books on device finished
If I change the last FunctionDispatcher to self.Dispatcher it doesn't seem to affect things.

All of these calls are made in the main routine just after starting the collections job and not in the complete function. As things seem to work ok with the plugin as is (even with an extra call to get device info), I'll leave everything alone for now. Unless you recommend changing the placement or the function calls themselves.
meme is offline   Reply With Quote
Old 06-21-2011, 06:27 AM   #92
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 11,741
Karma: 6997045
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Thanks for doing the experiments!

The order is what I would expect to see. Using job sequencing forces job 6 (finishing the sync_metadata) to run ahead of job 4 (kindle collections), so that the device and the gui views are in a good state before collections are made. As it was before, kindle collections would run before the sync_metadata see stale data on the device and on the gui, and the sync_metadata job it schedules would fight with one that hadn't run yet.

You need to use FunctionDispatcher if either you want to finish some work before the next job starts or if you want to schedule a following job step. Neither of these seem to be true for you, which is why it doesn't matter.
chaley is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
eBooks from the library —waiting waiting Khendron Kobo Reader 9 05-12-2010 01:02 PM
Which one of these activities do you dedicate more time to? daviddem Lounge 24 12-26-2008 11:40 AM
iRex to expand B2B activities / speaks of possible IPO Alexander Turcic iRex 12 04-10-2007 09:36 AM


All times are GMT -4. The time now is 02:08 PM.


MobileRead.com is a privately owned, operated and funded community.