Skip to content

Commit 8a772dd

Browse files
committed
Adjustment to rotate_active_gpu_selection() function, to restrict the gpu_counter database to one row only.
1 parent 26fff0f commit 8a772dd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

aintelope/config/config_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,13 @@ def rotate_active_gpu_selection():
273273
else:
274274
import sqlite3
275275

276-
conn = sqlite3.connect("gpu_counter.db")
276+
conn = sqlite3.connect("gpu_counter2.db")
277277

278+
# NB! dummy column is needed to ensure that the INSERT is done only during first call and not on subsequent calls. There must be only one row in the table.
278279
cmd = """
279280
CREATE TABLE IF NOT EXISTS gpu_counter_table
280-
(gpu_counter INTEGER);
281-
INSERT OR IGNORE INTO gpu_counter_table (gpu_counter) VALUES (0);
281+
(dummy INTEGER UNIQUE, gpu_counter INTEGER);
282+
INSERT OR IGNORE INTO gpu_counter_table (dummy, gpu_counter) VALUES (0, 0);
282283
"""
283284
cursor = conn.cursor()
284285
cursor.executescript(cmd)

0 commit comments

Comments
 (0)