BVB Source Codes

rq Show dummy.py Source code

Return Download rq: download dummy.py Source code - Download rq Source code - Type:.py
  1. # -*- coding: utf-8 -*-
  2. """
  3. Some dummy tasks that are well-suited for generating load for testing purposes.
  4. """
  5. from __future__ import (absolute_import, division, print_function,
  6.                         unicode_literals)
  7.  
  8. import random
  9. import time
  10.  
  11.  
  12. def do_nothing():
  13.     pass
  14.  
  15.  
  16. def sleep(secs):
  17.     time.sleep(secs)
  18.  
  19.  
  20. def endless_loop():
  21.     while True:
  22.         time.sleep(1)
  23.  
  24.  
  25. def div_by_zero():
  26.     1 / 0
  27.  
  28.  
  29. def fib(n):
  30.     if n <= 1:
  31.         return 1
  32.     else:
  33.         return fib(n - 2) + fib(n - 1)
  34.  
  35.  
  36. def random_failure():
  37.     if random.choice([True, False]):
  38.         class RandomError(Exception):
  39.             pass
  40.         raise RandomError('Ouch!')
  41.     return 'OK'
  42.  
downloaddummy.py Source code - Download rq Source code
Related Source Codes/Software:
amazon-dsstne - Deep Scalable Sparse Tensor Network Engine (DSSTNE... 2017-01-08
webpack-demos - a collection of simple demos of Webpack 2017-01-08
Squire - HTML5 rich text editor. Try the demo integration a... 2017-01-08
thor - Thor is a toolkit for building powerful command-li... 2017-01-08
glide - Package Management for Golang h... 2017-01-08
emmet-vim - emmet for vim: http://emmet.io/ ... 2017-01-08
prose - A Content Editor for GitHub. ht... 2017-01-08
sshrc - ring your .bashrc, .vimrc, etc. with you when you ... 2017-01-08
typed.js - A jQuery typing animation script. ... 2017-01-08
find - High-precision indoor positioning framework for mo... 2017-01-08
lumX - 2017-04-26
Messenger-for-Desktop - Bring messenger.com to your OS X, Windows or Linux... 2017-04-26
netfox - A lightweight, one line setup, iOS / OSX network d... 2017-04-26
jsdiff - A javascript text differencing implementation. 2017-04-26
hello-world - Hello world in every programming language. Thanks ... 2017-04-26
socialite - 2017-04-26
Terasology - Terasology - open source voxel world ... 2017-04-25
geddy - Web framework for Node.js h... 2017-04-25
gh-unit - DEPRECATED Test Framework for Objective-C 2017-04-25
zen - IOS, Swift, Objective - C 2017-04-25

 Back to top