Skip to content
Snippets Groups Projects
Commit 200ea938 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Do not store use_cache

parent 0a4bbe4b
No related branches found
No related tags found
1 merge request!67Store created elements in a local SQLite database
Pipeline #78299 passed
......@@ -50,9 +50,7 @@ class BaseWorker(object):
logger.info(f"Worker will use {self.work_dir} as working directory")
self.use_cache = use_cache
if self.use_cache:
if use_cache is True:
if os.environ.get("TASK_ID") and os.path.isdir(CACHE_DIR):
cache_path = os.path.join(CACHE_DIR, "db.sqlite")
else:
......@@ -60,6 +58,9 @@ class BaseWorker(object):
self.cache = LocalDB(cache_path)
self.cache.create_tables()
else:
self.cache = None
logger.debug("Cache is disabled")
@property
def is_read_only(self):
......@@ -466,7 +467,7 @@ class ElementsWorker(BaseWorker):
for element in elements:
self.report.add_element(parent.id, element["type"])
if self.use_cache:
if self.cache:
# Store elements in local cache
try:
parent_id_hex = convert_str_uuid_to_hex(parent.id)
......
......@@ -33,8 +33,7 @@ def test_init_with_local_cache(monkeypatch):
assert worker.work_dir == os.path.expanduser("~/.local/share/arkindex")
assert worker.worker_version_id == "12341234-1234-1234-1234-123412341234"
assert worker.use_cache
assert worker.cache
assert worker.cache is not None
def test_init_var_ponos_data_given(monkeypatch):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment