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

Fix last version of Peewee and others methods deprecated #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion oct/core/turrets_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def write(self, turret):

:param dict turret_data: the data of the turret to write
"""
with db.execution_context():
with db:
turret.save()

def publish(self, message, channel=None):
Expand Down
4 changes: 2 additions & 2 deletions oct/results/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ def set_database(db_url, proxy, config):
db_config = config.get('results_database', {}).get('params', {})

if 'testing' in config and config['testing'] is True:
database = connect('sqlite:////tmp/results.sqlite', check_same_thread=False, threadlocals=True)
database = connect('sqlite:////tmp/results.sqlite', check_same_thread=False)
else:
if os.path.isfile(db_url) or os.path.isdir(os.path.dirname(db_url)):
db_url = "sqlite:///" + db_url
db_config.update(check_same_thread=False, threadlocals=True)
db_config.update(check_same_thread=False)
database = connect(db_url, **db_config)
proxy.initialize(database)
2 changes: 1 addition & 1 deletion oct/results/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _init_dataframes(self):
"""Initialise the main dataframe for the results and the custom timers dataframes
"""
df = pd.read_sql_query("SELECT elapsed, epoch, scriptrun_time, custom_timers FROM result ORDER BY epoch ASC",
db.get_conn())
db.connection())

self._get_all_timers(df)
self.main_results = self._get_processed_dataframe(df)
Expand Down
6 changes: 3 additions & 3 deletions oct/results/stats_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def init_stats(output_dir, config):

tables_to_create = [t for t in [Result, Turret] if not t.table_exists()]

db.get_conn()
db.connection()
db.create_tables(tables_to_create)


Expand All @@ -42,7 +42,7 @@ def write_result(self, data):
self.results.append(data)

if len(self.results) >= 150: # 150 rows for SQLite default limit
with db.execution_context():
with db:
with db.atomic():
Result.insert_many(self.results).execute()
del self.results[:]
Expand All @@ -52,7 +52,7 @@ def write_remaining(self):
"""
if not self.results:
return
with db.execution_context():
with db:
with db.atomic():
Result.insert_many(self.results).execute()
del self.results[:]