#NEWLINE# @ login_required #NEWLINE# def index( request ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# client = Client ( request ) #NEWLINE# #UNINDENT# except ConnectionError : #NEWLINE# #INDENT# return render_unavailable ( ) #NEWLINE# #UNINDENT# checks_errors = checks . run_all ( client ) #NEWLINE# stats = _multiget ( client . stats ( ) , [ 'current-connections' , 'uptime' , 'job-timeouts' , 'version' , 'current-jobs-buried' , 'total-jobs' ] ) #NEWLINE# if ( 'uptime' in request ) : #NEWLINE# #INDENT# days = ( ( ( float ( stats [ 'uptime' ] ) / 60.0 ) / 60.0 ) / 24.0 ) #NEWLINE# stats [ 'uptime' ] = ( '%s (%.2f days)' % ( stats [ 'uptime' ] , days ) ) #NEWLINE# #UNINDENT# tube_stats = [ ] #NEWLINE# for tube in client . tubes ( ) : #NEWLINE# #INDENT# tube_stats . append ( _multiget ( client . stats_tube ( tube ) , [ 'name' , 'pause' , 'current-jobs-buried' , 'current-waiting' , 'total-jobs' ] ) ) #NEWLINE# #UNINDENT# return render_to_response ( 'beanstalk/index.html' , { #NEWLINE# #INDENT# 'stats' : stats , #NEWLINE# 'tube_stats' : tube_stats , #NEWLINE# 'checks_errors' : checks_errors , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )