-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jason Tackaberry wrote: | On Thu, 2008-02-14 at 19:07 +0100, Duncan Webb wrote: |> What happens is: |> freevo execute src/tv/record_client.py getNextProgramStart |> xml_rpc_server at 'http://localhost:18001/' |> 06:20: getNextProgramStart begin |> 06:20: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0xb6eea24c> | | But are you sure that the InProgress that the first rpc yields ever | finishes? | | In any case, try updating svn and let me know. This this works for me | on python 2.4: | | import kaa, sys | | @kaa.coroutine() | def delayed(): | cb = kaa.InProgressCallback() | kaa.OneShotTimer(cb, 42).start(0.5) | yield cb | yield cb.get_result() | | @kaa.coroutine() | def foo(): | for i in range(5): | p = delayed() | yield p | print "%d:" %i, p.get_result() | sys.exit(1) | | foo() | kaa.main.run()
This works, it gives: python foo.py 0: 42 1: 42 2: 42 3: 42 4: 42 Asynctest also works: python base/test/asynctest.py 1 fast needs more time 2 3 subyield needs more time 4 5 6 (7, 8) None 9 10 {'foo': 11, 'bar': 12} 13 crash test ok 14 connect to server server tests (15, True) (16, False) 17 18 2008-02-14 21:40:43,265 [ERROR] rpc(527): ['test1', 'test3', 'test2', 'test5', 'test4', 'test6', 'shutdown'] bad rpc test ok remote rpc exception test ok ========= A traceback (for rpc) is expected below: Exception during RPC call 'test6'; remote traceback follows: ~ File "/usr/lib/python2.4/site-packages/kaa/rpc.py", line 521, in _handle_packet_after_auth ~ result = self._callbacks[function](*args, **kwargs) ~ File "base/test/asynctest.py", line 43, in test6 ~ raise ValueError ValueError 19 20 21 server down My code works better and gives: freevo execute src/tv/record_client.py getNextProgramStart 0.000: getNextProgramStart begin 0.023: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0xb6eef1ec> 9.850: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0xb6eef1ec> shutdown.result='bye' Under Python 2.5 (AMD64) I get this: # freevo execute src/tv/record_client.py getNextProgramStart 0.000: getNextProgramStart begin 0.011: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0x2aea687a5710> 5.686: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0x2aea687a5710> shutdown.result='bye' # freevo execute src/tv/record_client.py updateFavoritesScheduleNow 5.680: result: (1, 'favorites schedule updated') Under Python 2.4 (P3) this: # freevo execute src/tv/record_client.py getNextProgramStart 0.000: getNextProgramStart begin 0.022: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0xb6f471cc> 9.741: getNextProgramStart.progress=<kaa.notifier.async.InProgress object at 0xb6f471cc> shutdown.result='bye' # freevo execute src/tv/record_client.py updateFavoritesScheduleNow 9.739: result: (1, 'favorites schedule updated') shutdown.result='bye' The timings make sense but the get_result is blocking in the coroutine but is okay for the wait. The code from record_client is: ~ def updateFavoritesScheduleNow(self): ~ """ Update the favorites scbedule, returning the object """ ~ _debug_('updateFavoritesScheduleNow()', 2) ~ progress = self.recordserver_rpc('updateFavoritesSchedule') ~ if progress is None: ~ return None ~ progress.wait() ~ result = progress.get_result() ~ _debug_('getScheduledRecordingsNow.result=%r' % (result,), 2) ~ return result [snip] ~ if function == "updatefavoritesschedulenow": ~ start = time.time() ~ result = rc.updateFavoritesScheduleNow() ~ print '%s: result: %r' % (rc.timeit(start), result) Sorry this is a bit long, and the current version of record_client.py is checked in at r10369. Duncan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHtKviNi6l+Xvys44RAgieAJ9w1jo389dJLeuz8HyBqhE64CJ6qwCePIq+ qRgG6HM+wnBuzf1pU/KJePs= =9Kv1 -----END PGP SIGNATURE----- ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel