Gilad Rubin
07/22/2024, 1:59 PMfrom hamilton.plugins import h_diskcache
from hamilton.driver import Builder
cache_adapter = h_diskcache.DiskCacheAdapter()
builder = (Builder()
.with_adapters(cache_adapter)
)
It runs for about a minute and then outputs:
---------------------------------------------------------------------------
OperationalError Traceback (most recent call last)
Cell In[9], <vscode-notebook-cell:?execution_count=9&line=4|line 4>
<vscode-notebook-cell:?execution_count=9&line=1|1> from hamilton.plugins import h_diskcache
<vscode-notebook-cell:?execution_count=9&line=2|2> from hamilton.driver import Builder
----> <vscode-notebook-cell:?execution_count=9&line=4|4> cache_adapter = h_diskcache.DiskCacheAdapter()
<vscode-notebook-cell:?execution_count=9&line=6|6> builder = (Builder()
<vscode-notebook-cell:?execution_count=9&line=7|7> .with_adapters(cache_adapter)
<vscode-notebook-cell:?execution_count=9&line=8|8> )
File /anaconda/envs/pdf-env/lib/python3.10/site-packages/hamilton/plugins/h_diskcache.py:84, in DiskCacheAdapter.__init__(self, cache_vars, cache_path, **cache_settings)
82 self.cache_vars = cache_vars if cache_vars else []
83 self.cache_path = cache_path
---> 84 self.cache = diskcache.Cache(directory=cache_path, **cache_settings)
85 self.nodes_history: Dict[str, List[str]] = self.cache.get(
86 key=DiskCacheAdapter.nodes_history_key, default=dict()
87 ) # type: ignore
88 self.used_nodes_hash: Dict[str, str] = dict()
File /anaconda/envs/pdf-env/lib/python3.10/site-packages/diskcache/core.py:478, in Cache.__init__(self, directory, timeout, disk, **settings)
476 for key, value in sorted(sets.items()):
477 if key.startswith('sqlite_'):
--> 478 self.reset(key, value, update=False)
480 sql(
481 'CREATE TABLE IF NOT EXISTS Settings ('
482 ' key TEXT NOT NULL UNIQUE,'
483 ' value)'
484 )
486 # Setup Disk object (must happen after settings initialized).
File /anaconda/envs/pdf-env/lib/python3.10/site-packages/diskcache/core.py:2438, in Cache.reset(self, key, value, update)
2436 update = True
2437 if update:
-> 2438 sql('PRAGMA %s = %s' % (pragma, value)).fetchall()
2439 break
2440 except sqlite3.OperationalError as exc:
OperationalError: database is locked
===
Any ideas?Stefan Krawczyk
07/22/2024, 2:23 PM.
where the code ran there should be some fileStefan Krawczyk
07/22/2024, 2:24 PMStefan Krawczyk
07/22/2024, 2:24 PMDiskCacheAdapter
Gilad Rubin
07/22/2024, 2:27 PMStefan Krawczyk
07/22/2024, 2:29 PMGilad Rubin
07/22/2024, 2:30 PMStefan Krawczyk
07/22/2024, 3:57 PMGilad Rubin
07/22/2024, 4:08 PMStefan Krawczyk
07/22/2024, 10:18 PMStefan Krawczyk
07/22/2024, 10:18 PMStefan Krawczyk
07/22/2024, 10:19 PMGilad Rubin
07/23/2024, 7:32 AM