multi-mechanize
multi-mechanize copied to clipboard
multi-mechanize still doesn't work on Windows
Hi,
i can't run multi-mechanize successfully on Windows 7.
When i run the project, i get two issues (after applied the "import sys" to the resultswriter.py):
ERROR: Can not create output directory
and
Traceback (most recent call last):
File "C:\Python26\Scripts\multimech-run-script.py", line 8, in <module>
load_entry_point('multi-mechanize==1.2.0.1', 'console_scripts', 'multimech-run')()
File "C:\Python26\lib\site-packages\multimechanize\utilities\run.py", line 67, in main
run_test(project_name, cmd_opts)
File "C:\Python26\lib\site-packages\multimechanize\utilities\run.py", line 139, in run_test
results.output_results(output_dir, 'results.csv', run_time, rampup, results_ts_interval, user_group_configs, xml_report)
File "C:\Python26\lib\site-packages\multimechanize\results.py", line 19, in output_results
results = Results(results_dir + results_file, run_time)
File "C:\Python26\lib\site-packages\multimechanize\results.py", line 253, in __init__
self.epoch_start = self.resp_stats_list[0].epoch_secs
IndexError: list index out of range
The first problem raises when the program tries to recreate the folder that has already created. I believe that this problem is connected to some thread-problem.
All i get is a result folder with an empty csv.
System: Windows 7 64-bit Python 2.6 32-bit multi-mechanize last master commit (pip install git+)
config
[global]
run_time = 30
rampup = 1
results_ts_interval = 10
[user_group-1]
threads = 10
script = v2_user.py
import requests
class Transaction(object):
def run(self):
r = requests.get('https://github.com/timeline.json')
r.raw.read()
Files are really similar or equal to the docs.
What can the problem be?
I'm not so good at python to work out a solution.
I meet the same problem. This helped https://groups.google.com/forum/?fromgroups=#!topic/multi-mechanize/nweLvopvFOM : "In case it could be useful to others, just to let you know I resolved this by modifying run.py line 90: user_group.run() instead of user_group.start(). For some reason, with user_group.start() the UserGroup run method was never called."
"modifying run.py line 90:" Additionally make sure to turn off console logging as the join() will not work.
This worked for me on windows 7 64 bit, python 2.7 I don't know enough about python threading to say why, but it's a bug for sure.
The real reason it's not working on windows, it's cause multiprocessing couldn't pickle some of the objects on the Process
Changing it .start call to .run just run the whole thing sequentially in one process (it seems to work, but in big number of virtual users, you'll run out of file descriptors per process)
Moving to use pathos.multiprocessing might solve some of the pickling issues https://github.com/uqfoundation/pathos
I'll give it a go, to see if I can fix it correctly
EDIT: It works correctly in the latest development version. To install it, run pip install -e git+http://github.com/cgoldberg/multi-mechanize.git#egg=multimechanize
OP: This is still happening with release version 1.2.0, and in the untouched sample project created by multimech-newproject
nonetheless. And there's another error. It can't find the test scripts. I'm really confused how to solve this.
C:\my_folder>multimech-run multimech-sample
user_groups: 2
threads: 6
ERROR: can not find test script: v_user.py. aborting user group: user_group-1 errors: 0
ERROR: can not find test script: v_user.py. aborting user group: user_group-1
ERROR: can not find test script: v_user.py. aborting user group: user_group-1
ERROR: can not find test script: v_user.py. aborting user group: user_group-2
ERROR: can not find test script: v_user.py. aborting user group: user_group-2
ERROR: can not find test script: v_user.py. aborting user group: user_group-2
[================100%==================] 30s/30s transactions: 0 timers: 0 errors: 0
analyzing results...
Traceback (most recent call last):
File "C:\Python27\Scripts\multimech-run-script.py", line 11, in <module>
load_entry_point('multi-mechanize==1.2.0', 'console_scripts', 'multimech-run')()
File "c:\python27\lib\site-packages\multimechanize\utilities\run.py", line 64, in main
run_test()
File "c:\python27\lib\site-packages\multimechanize\utilities\run.py", line 131, in run_test
results.output_results(output_dir, 'results.csv', run_time, rampup, results_ts_interval, user_group_configs, xml_report)
File "c:\python27\lib\site-packages\multimechanize\results.py", line 19, in output_results
results = Results(results_dir + results_file, run_time)
File "c:\python27\lib\site-packages\multimechanize\results.py", line 253, in __init__
self.epoch_start = self.resp_stats_list[0].epoch_secs
IndexError: list index out of range
C:\my_folder>
I found that it's working correctly in the latest dev version. Now the question is, when will there be a new release? It's been more than 5 years now.