anselal / antminer-monitor

Cryptocurrency ASIC mining hardware monitor using a simple web interface
GNU General Public License v3.0
228 stars 145 forks source link

KeyError: 'POOLS' #139

Closed red0bear closed 4 years ago

red0bear commented 5 years ago

Well i got error now ....

builtins.IndexError IndexError: list index out of range

anselal commented 5 years ago

Need more info on that. Can you paste the complete error ?

red0bear commented 5 years ago

How could do that ? Do you have a command line please ?

red0bear commented 5 years ago

127.0.0.1 - - [30/Oct/2018 14:41:32] "GET / HTTP/1.1" 500 - Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/flask/app.py", line 2309, in call return self.wsgi_app(environ, start_response) File "/usr/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app response = self.handle_exception(e) File "/usr/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functionsrule.endpoint File "/usr/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view return func(*args, **kwargs) File "antminer-monitor/antminermonitor/blueprints/asicminer/views/antminer.py", line 105, in miners worker = active_pool[0]['User']

red0bear commented 5 years ago

builtins.KeyError

KeyError: 'POOLS' Traceback (most recent call last)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app

response = self.handle_exception(e)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise

raise value

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise

raise value

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/usr/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view

return func(*args, **kwargs)

File "antminer-monitor/antminermonitor/blueprints/asicminer/views/antminer.py", line 102, in miners

pool for pool in miner_pools['POOLS'] #if pool['Stratum Active']

KeyError: 'POOL
anselal commented 5 years ago

Will look into that. I will need to add some exceptions and print some info about the miner like the IP Address so we have an ideawhich machine is causing tbe error

anselal commented 5 years ago

This was closed with #124 Maybe you are running an older version ?

red0bear commented 5 years ago

im running the last version i get in git hub. Did you make some update right now ?

anselal commented 5 years ago

No

red0bear commented 5 years ago

Well ... so still something wrong then ...

anselal commented 5 years ago

Please try to increase the socket timeout in the lib/pycgminer.py file and let me know if that helped

red0bear commented 5 years ago

Ok.

anselal commented 5 years ago

Any feedback ?

red0bear commented 5 years ago

@anselal im so sorry ... i didnt get enough time time to see that. i will do soon. Im bit busy.

red0bear commented 5 years ago

sock.settimeout(1) ????

anselal commented 5 years ago

No problem,

yes, try to increase it to 2, 3, or 5 seconds

red0bear commented 5 years ago

@anselal i put 10 because low time sometimes give some problems.

anselal commented 5 years ago

OK. Let it run for a couple of days and it fixes the error come back and close the issue

fcabrera1109 commented 5 years ago

HI guys I have same issue it started once I added the last miner somewhere around 50 I did increase the socket as directed above and no change

red0bear commented 5 years ago

@fcabrera1109 what version from python are you using ? i faced anothers errors but seem ok right now for me .

fcabrera1109 commented 5 years ago

Python 2.7.5

red0bear commented 5 years ago

@fcabrera1109 can you try python 3.6 ? im doing this on it.

fcabrera1109 commented 5 years ago

let me try and install

fcabrera1109 commented 5 years ago

python3.6 manage.py run -h 0.0.0.0 -p 5000 ran this got

File "manage.py", line 3, in from flask.cli import FlaskGroup ModuleNotFoundError: No module named 'flask'

red0bear commented 5 years ago

Did you install are requirements ?

fcabrera1109 commented 5 years ago

I believe so when I run "pip install flask". says all requirements already installed

fcabrera1109 commented 5 years ago

yes all installed and got this when I try and load page

Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/flask/app.py", line 2309, in call return self.wsgi_app(environ, start_response) File "/usr/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app response = self.handle_exception(e) File "/usr/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise raise value File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functionsrule.endpoint File "/usr/lib/python3.6/site-packages/flask_login/utils.py", line 261, in decorated_view return func(*args, **kwargs) File "/var/www/antminer-monitor-master/antminermonitor/blueprints/asicminer/views/antminer.py", line 105, in miners worker = active_pool[0]['User'] IndexError: list index out of range

red0bear commented 5 years ago

hummmm .... i think some missing lib like me .... when i try install first time ... now you need do a work around to discover whats going on in package.

fcabrera1109 commented 5 years ago

Do you've many miners? It ws working fine until the last one I added and broke page

red0bear commented 5 years ago

in antminer.py make a change

pool for pool in miner_pools['POOLS'] if pool['Stratum Active']

to @pool for pool in miner_pools['POOLS'] #if pool['Stratum Active']

and try again .

fcabrera1109 commented 5 years ago

FYI I started with new DB and working again. I believe it a limitation of DB or code display when to many rows

anselal commented 5 years ago

@red0bear commenting out the if statement will make the software always showing the 1st worker regardless if the miner has switched to the 2nd or 3rd pool

fcabrera1109 commented 5 years ago

I will start adding again and see when it breaks

anselal commented 5 years ago

My software has no limits !!!! The limit is the sky !!!!

red0bear commented 5 years ago

@anselal limits is only money in your pocket to buy a good computer.

anselal commented 5 years ago

Money is irelevant

fcabrera1109 commented 5 years ago

So it breaks around 40 miners

fcabrera1109 commented 5 years ago

just started from scratch and broke it at about 40 miners some had errors think its something with layout

fcabrera1109 commented 5 years ago

@anselal any idea why its breaking at around 40 miners. I think its not the actual active miner pane breaking it but the inactive/error one.

fcabrera1109 commented 5 years ago

if that she case its 13-14 errors.

fcabrera1109 commented 5 years ago

that worked!!

fixed it :)

red0bear commented 5 years ago

@fcabrera1109 what ? :-)

anselal commented 5 years ago

My software can handle hundreds maybe even thousands of miners.

anselal commented 5 years ago

@fcabrera1109 feedback please

fcabrera1109 commented 5 years ago

the change anselal had me make worked.

in antminer.py make a change

pool for pool in miner_pools['POOLS'] if pool['Stratum Active']

to @pool for pool in miner_pools['POOLS'] #if pool['Stratum Active']

and try again .

anselal commented 5 years ago

I explained abive why the code is wrong. It will show the wrong pool user if tje miner switches to other than the first.

I will taoe a look at it.

@fcabrera1109 what models are your miners ?

fcabrera1109 commented 5 years ago

Well new error today when I don't have an entry in first pool for the miner

TypeError: Object of type 'bytes' is not JSON serializable

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__

return self.wsgi_app(environ, start_response)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app

response = self.handle_exception(e)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise

raise value

File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app

response = self.full_dispatch_request()

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request

rv = self.handle_user_exception(e)

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception

reraise(exc_type, exc_value, tb)

File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise

raise value

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request

rv = self.dispatch_request()

File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request

return self.view_functions[rule.endpoint](**req.view_args)

File "/var/www/antminer-monitor-master/antminermonitor/blueprints/user/views.py", line 16, in login

form = LoginForm()

File "/usr/lib/python3.6/site-packages/wtforms/form.py", line 212, in __call__

return type.__call__(cls, *args, **kwargs)

File "/usr/lib/python3.6/site-packages/flask_wtf/form.py", line 88, in __init__

super(FlaskForm, self).__init__(formdata=formdata, **kwargs)

File "/usr/lib/python3.6/site-packages/wtforms/form.py", line 278, in __init__

self.process(formdata, obj, data=data, **kwargs)

File "/usr/lib/python3.6/site-packages/wtforms/form.py", line 132, in process

field.process(formdata)

File "/usr/lib/python3.6/site-packages/wtforms/csrf/core.py", line 43, in process

self.current_token = self.csrf_impl.generate_csrf_token(self)

File "/usr/lib/python3.6/site-packages/flask_wtf/csrf.py", line 134, in generate_csrf_token

token_key=self.meta.csrf_field_name

File "/usr/lib/python3.6/site-packages/flask_wtf/csrf.py", line 47, in generate_csrf

setattr(g, field_name, s.dumps(session[field_name]))

File "/usr/lib/python3.6/site-packages/itsdangerous/serializer.py", line 166, in dumps

payload = want_bytes(self.dump_payload(obj))

File "/usr/lib/python3.6/site-packages/itsdangerous/url_safe.py", line 42, in dump_payload

json = super(URLSafeSerializerMixin, self).dump_payload(obj)

File "/usr/lib/python3.6/site-packages/itsdangerous/serializer.py", line 133, in dump_payload

return want_bytes(self.serializer.dumps(obj, **self.serializer_kwargs))

File "/usr/lib/python3.6/site-packages/itsdangerous/_json.py", line 18, in dumps

return json.dumps(obj, **kwargs)

File "/usr/lib64/python3.6/json/__init__.py", line 238, in dumps

**kw).encode(obj)

File "/usr/lib64/python3.6/json/encoder.py", line 199, in encode

chunks = self.iterencode(o, _one_shot=True)

File "/usr/lib64/python3.6/json/encoder.py", line 257, in iterencode

return _iterencode(o, 0)

File "/usr/lib64/python3.6/json/encoder.py", line 180, in default

o.__class__.__name__)

TypeError: Object of type 'bytes' is not JSON serializable
fcabrera1109 commented 5 years ago

I think that the issue because I deleted the first entry for each miner to have them mine on second entry

anselal commented 5 years ago

This is why you need the if statement you deleted.

fcabrera1109 commented 5 years ago

If I remove the # and unremarkable it it still gives same error,

red0bear commented 5 years ago

@fcabrera1109 @anselal well ... here i just make that and i still get errors. But at least it recover from error. I see more a problem with exceptions.