deesnow / ossi_tool

ISC License
4 stars 8 forks source link

option to change prompt timeout check #6

Closed deesnow closed 4 years ago

deesnow commented 4 years ago

New request come from @fiodorpugach

"Yesterday I run ossi-tool to query bridged appearances on 12000 stations. It took around 7 hours because of 2 seconds timeout between command executions. Report query from ASA 'display station 00000 count 12000' takes only 5 minutes for the same 12000 stations. Is it possible to reduce inter-command timeout at least to 0.2 seconds, or make another switch so user will be able to put timeout of his choice based on system performance?"

deesnow commented 4 years ago

Release 0.3.3.5 contains '-t' option to have this fine-tuning possibility.

Be careful with it. With -t use only same type of commands in input file which has same running time. If the timer is lower than the command running time it leads to script crash.

fiodorpugach commented 4 years ago

It doesn't seem to be working. Without -t option timeout is still 2 seconds. With -t option there is no timeout at all regardless digits after -t (I tried with and without space). I tested on series of 'list bridged xxxxx' in Input file. Without timeout some command lines in Input file were failed. Another thing will be nice to have: series of 'clear amw all xxxxx' commands in Input file. Now the first command times out with errors. Thank you!

deesnow commented 4 years ago

I have tested it but it seems OK to me. Without -t the default 2 sec is used, so that is normal.

2020-04-07 13_49_59-Clipboard

I currently thinking on to dynamically increase the timeout if previous is failed to a maximum value. This way it automatically tune itself to the applied command. Unfortunately I'm busy now, so can implement it later.

deesnow commented 4 years ago

@fiodorpugach

Another thing will be nice to have: series of 'clear amw all xxxxx' commands in Input file. Now the first command times out with errors.

Update to 0.3.3.6 It will handle however there is no output because the terminal just drop the prompt back. If you want this case I can send back a 'Done' or any other message.

fiodorpugach commented 4 years ago

I just updated to 0.3.3.6 and tried 'clear amw all xxxxx'. I'm getting that:

--- Let Start! --- --- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

^@Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 332, in main a.cmd_parser(args.inputfile) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 174, in cmd_parser self.ossi_cmd(self.cmd) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 233, in ossi_cmd if self.index != 3: AttributeError: 'Ossi' object has no attribute 'index'

Thank you for working on ossi-tool!

fiodorpugach commented 4 years ago

Also please test -t with many lines of some command in Input.csv file. In my case there is no any timeout even if I put -t 2 for 2 seconds; terminal lines scroll very fast and some commands are failed. Without -t it works fine with 2 seconds timeout. Thank you!

deesnow commented 4 years ago

I just updated to 0.3.3.6 and tried 'clear amw all xxxxx'. I'm getting that:

--- Let Start! ---

--- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

^@Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 332, in main a.cmd_parser(args.inputfile) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 174, in cmd_parser self.ossi_cmd(self.cmd) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 233, in ossi_cmd if self.index != 3: AttributeError: 'Ossi' object has no attribute 'index'

Thank you for working on ossi-tool!

Can you send me some line from your imput.csv and the debug.log.

THX

fiodorpugach commented 4 years ago

debug.log

fiodorpugach commented 4 years ago

Input.txt:

clear amw all 77700 clear amw all 77701 clear amw all 77702

fiodorpugach commented 4 years ago

Thank you!

fiodorpugach commented 4 years ago

That was a typo, I used Input. csv (not Input .txt):

Input.csv:

clear amw all 77700 clear amw all 77701 clear amw all 77702

deesnow commented 4 years ago

That was a typo, I used Input. csv (not Input .txt):

Input.csv:

clear amw all 77700 clear amw all 77701 clear amw all 77702

Could you check it like this:

clear, amw, all, 77700 clear, amw, all, 77701 clear, amw, all, 77702

So commands and parameters should be separated by coma for all command.

fiodorpugach commented 4 years ago

I just tried with commas:

clear, amw, all, 77700 clear, amw, all, 77701 clear, amw, all, 77702 The same thing - after the first line it times out with errors:

--- Let Start! --- --- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 332, in main a.cmd_parser(args.inputfile) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 174, in cmd_parser self.ossi_cmd(self.cmd) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 233, in ossi_cmd if self.index != 3: AttributeError: 'Ossi' object has no attribute 'index'

fiodorpugach commented 4 years ago

Output.csv looks like that (it goes over and over the first line):


clear amw all 77700


clear amw all 77700


clear amw all 77700


clear amw all 77700


clear amw all 77700

deesnow commented 4 years ago

Output.csv looks like that (it goes over and over the first line):

clear amw all 77700

clear amw all 77700

clear amw all 77700

clear amw all 77700

clear amw all 77700

If you use the same output.csv and it crash always with at the 1st line than the ossi_tool just append it to the end of the output file. So the original one is not over-writen but append.

deesnow commented 4 years ago

I just tried with commas:

clear, amw, all, 77700 clear, amw, all, 77701 clear, amw, all, 77702 The same thing - after the first line it times out with errors:

--- Let Start! ---

--- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 332, in main a.cmd_parser(args.inputfile) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 174, in cmd_parser self.ossi_cmd(self.cmd) File "/home/fiodor/.local/lib/python2.7/site-packages/ossi_tool/ossit.py", line 233, in ossi_cmd if self.index != 3: AttributeError: 'Ossi' object has no attribute 'index'

Could you download only the ossit.py from https://github.com/deesnow/ossi_tool/blob/master/ossi_tool/ossit.py

and put it to the /usr/local/lib/python2.7/dist-packages/ossi_tool/ folder. I dont want to create a new relase until this is not fixed. It should fix the AttributeError.

In my CM it does not drop error, however the is no messaging system.

deesnow commented 4 years ago

You can connect to my Discord server and we can have a chat: https://discord.gg/wa6MGjt

fiodorpugach commented 4 years ago

I downloaded and replaced ossit.py file. Unfortunately nothing has been changed. It tries the first line several times, then drops error: --- Let Start! --- --- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 332, in main File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 174, in cmd_parser File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 233, in ossi_cmd AttributeError: 'Ossi' object has no attribute 'index'

fiodorpugach commented 4 years ago

debug.log

deesnow commented 4 years ago

I think I catch the problem.

Here is new ossit.py https://github.com/deesnow/ossi_tool/blob/version-1/ossi_tool/ossit.py

Could you check it?

fiodorpugach commented 4 years ago

I just tried the new ossit.py - the same thing:

--- Let Start! --- --- Connection established --- --- Ossi is logged in and ready --- -- Input.csv is opened --

clear amw all 77700

Traceback (most recent call last): File "/home/fiodor/.local/bin/ossi_tool", line 11, in sys.exit(main()) File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 332, in main File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 174, in cmd_parser File "/tmp/pip-build-NjDm0h/ossi-tool/ossi_tool/ossit.py", line 233, in ossi_cmd AttributeError: 'Ossi' object has no attribute 'index'

fiodorpugach commented 4 years ago

debug.log

fiodorpugach commented 4 years ago

It actually worked! The problem was in compilation. There is not enough just change ossit.py file. I had to delete ossit.pyc file and manually compile with 'sudo python -m compileall /home/user/.local/lib/python2.7/site-packages/ossi_tool' Now it works fine not only for 'clear amw all xxxxx', but also for 'remove station xxxxx' , so now I can put them in one script and don't have to use ASA Import for station removal. THANK YOU!!!

fiodorpugach commented 4 years ago

One more thing. My input.csv file has multiple 'remove station xxxxx' lines. It works fine, but on any error (like station in use, bridged line appearance should be removed, etc.) it drops to terminal just 'command error' statement without actual error text. Output.csv file does not even have 'command error' statements, it has only input command echo. It will be nice to have at least 'command error' statements in output.csv file; it will be perfect to have actual error text in output.csv. Thank you for your work on ossi-tool!

deesnow commented 4 years ago

0.4rc2 released