#NEWLINE# def onJoin( self , details ) : #NEWLINE# #INDENT# print ( 'session attached' ) #NEWLINE# def got( res , started , msg ) : #NEWLINE# #INDENT# duration = ( 1000.0 * ( time . clock ( ) - started ) ) #NEWLINE# print ( '{}: {} in {}' . format ( msg , res , duration ) ) #NEWLINE# #UNINDENT# t1 = time . clock ( ) #NEWLINE# d1 = self . call ( 'com.math.slowsquare' , 3 ) #NEWLINE# d1 . addCallback ( got , t1 , 'Slow Square' ) #NEWLINE# t2 = time . clock ( ) #NEWLINE# d2 = self . call ( 'com.math.square' , 3 ) #NEWLINE# d2 . addCallback ( got , d2 , 'Quick Square' ) #NEWLINE# def done( _ ) : #NEWLINE# #INDENT# print ( 'All finished.' ) #NEWLINE# self . leave ( ) #NEWLINE# #UNINDENT# DeferredList ( [ d1 , d2 ] ) . addBoth ( done )