oct.utilities package¶
This module provide you basics shell commands to easily use the OCT module.
newproject module¶
This module provide you a command to create a new project directory. Once the library is installed you can use :
oct-newproject <project-name>
It will create a new directory named project-name with basic stuff inside.
The project structure must look like this :
.
├── config.cfg
├── templates
│ ├── css
│ │ └── style.css
│ ├── footer.html
│ ├── head.html
│ ├── img
│ └── scripts
└── test_scripts
└── v_user.py
With this basic project structure you can start writing your scripts, customize your templates, etc...
This project can be run with the command
multimech-run <project>
But for testing your scripts you can simply run them by using your standard python interpreter
The file config.cfg contain all configuration variable for your project. By default it’s look like this
[global]
run_time = 30
rampup = 0
results_ts_interval = 10
progress_bar = on
console_logging = off
xml_report = off
base_url = http://localhost
default_sleep_time = 2
statics_enabled = 1
[user_group-1]
threads = 3
script = v_user.py
[user_group-2]
threads = 3
script = v_user.py
For explanations :
This file give you two virtual user groups, each group has 3 user, and the user script is the v_user.py file.
To see all configuration variables explained see the Configuration section
Module doc¶
- oct.utilities.newproject.create_project(project_name, config_name='config.cfg', script_name='v_user.py', scripts_dir='test_scripts', config_content='\n[global]\nrun_time = 30\nrampup = 0\nresults_ts_interval = 10\nprogress_bar = on\nconsole_logging = off\nxml_report = off\nbase_url = http://localhost\ndefault_sleep_time = 2\nstatics_enabled = 1\n\n\n[user_group-1]\nthreads = 3\nscript = v_user.py\n\n[user_group-2]\nthreads = 3\nscript = v_user.py\n\n', script_content="\nfrom oct.core.generic import GenericTransaction\nimport random\nimport time\nimport os\n\n\nCONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../')\n\n\nclass Transaction(GenericTransaction):\n def __init__(self):\n GenericTransaction.__init__(self, True, CONFIG_PATH)\n\n def run(self):\n r = random.uniform(1, 2)\n time.sleep(r)\n self.custom_timers['Example_Timer'] = r\n\n\nif __name__ == '__main__':\n trans = Transaction()\n trans.run()\n print trans.custom_timers\n", template_dir='templates', head_content='\n<!DOCTYPE html>\n<html>\n\n<head>\n <title> OCT | Results </title>\n <link rel="stylesheet" type="text/css" href="css/style.css" />\n</head>\n\n<body id="main">\n', footer_content='\n</body>\n</html>\n')¶
- oct.utilities.newproject.main()¶
run module¶
TODO
WORK IN PROGRESS
This module give you access to the command :
oct-run <project>
This command will run your project using celery. For now the broker can only be configured in source code. It’s bind on a standard rabbitmq server.
The goal of this command is to run the same project in several rabbitmq instance.
Module doc¶
celery module¶
The configuration for running celery