On 3/10/06, Cory Dodt <corydodt@twistedmatrix.com> wrote:
Brian Granger wrote:
But, in many cases, the computeSomethingUsingTwisted() doesn't take long at all. An example of this would be probing the status of the remote server or a trivial computation that a server has relevant data for. In these cases, the result is available nearly instantly (faster then the user could detect, like 1 ms) and it is silly to have a job interface. You simply want the result directly.
Another approach: wait 10ms every time you push out a prompt. The problem is you're trying to generate the prompt in a synchronous manner in an asynchronous environment. 10ms is well below the threshhold that users will notice. You'll still want job control for long calculations, but you can present it in a more natural way.. if it's not available at the first prompt, it's a background job.
I am not super familiar with PyShell/PyCrust, but I think everything (including the prompt generation) is done asynchronously. The only thing that could really block would be long running python code executed in the users namespace in PyShell. But, I do like the idea of having immediate results return directly, but have everything else become a background job. But, the question still remains - how do you convert a Deferred() to a blocking, directly returned result?
C
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
-- Brian Granger Santa Clara University ellisonbg@gmail.com