Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbcon wrapper #4

Open
JrtPec opened this issue Feb 10, 2016 · 3 comments
Open

dbcon wrapper #4

JrtPec opened this issue Feb 10, 2016 · 3 comments

Comments

@JrtPec
Copy link
Member

JrtPec commented Feb 10, 2016

@kdebrab, @saroele I was able to take a look at Karel's code, to find out it works fine! Well done!

I did run in to some JsonDecodeError's in the beginning, when I was furiously adding, removing and syncing sensors, but this was behaviour I had also encountered sometime in the past so I don't think it has anything to do with what we're doing right now. I decided to start fresh: deleted my .tmpo-folder, pip-uninstalled tmpo so I could import directly from the branch.

Doing a houseprint.init_tmpo() works fine (which creates a tmpo session and adds all sensors), doing houseprint.sync_tmpos() also works fine. Fetching data works just as you'd expect.
I was able to init_tmpo on two separate houseprints in two separate notebooks, without getting the database locked errors. I can fetch data in one notebook, then go to the other one and fetch data too. No problems. The really cool part is I was able to run get_data() simultaneously in two separate notebooks!

Could you guys check it out too?

@saroele
Copy link
Member

saroele commented Feb 10, 2016

haha, it looks like @kdebrab did not have such a wasted evening after all :-) Well done Karel!

I hope to find some time tomorrow, not sure though. Work is absorbing me atm.

@saroele
Copy link
Member

saroele commented Feb 25, 2016

Hmmm, tested it now, but I still get OperationalError: database is locked sometimes. I have the impression though that the problem occurs less often.

To get more grip on the behaviour, I created a quick and dirty test. With the old tmpo, this test fails, with the new it works. Can you also try this? Here's the code:

import os
import tmpo
print(tmpo.__file__)

tmpo1 = tmpo.Session(os.getcwd())
tmpo1.add('key', 'token')
tmpo2 = tmpo.Session(os.getcwd())
tmpo2.add('key', 'token')

print("Test successful")

@JrtPec
Copy link
Member Author

JrtPec commented Feb 25, 2016

Indeed. This doesn't work on version 0.2.0, but it does on 0.2.1.

I would argue to move on and merge this. As far as I've tested the code it doesn't create any new issues, but it solves many. Granted there are still some other issues...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants