Skip to content

Commit

Permalink
add Reload the module to apply the new environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
wanliAlex committed Apr 12, 2024
1 parent 3ff8cee commit 2add027
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tests/s2_inference/test_vectorise_inference_cache.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import importlib
import os
import random
import sys
import unittest.mock
from concurrent.futures import ThreadPoolExecutor
from unittest.mock import patch

from concurrent.futures import ThreadPoolExecutor
import numpy as np
from PIL import Image

Expand All @@ -14,6 +16,9 @@ def _import_vectorise_with_inference_cache(self, cache_size: int = 50, cache_typ
"""Import the vectorise function with the specified cache size and type."""
os.environ["MARQO_INFERENCE_CACHE_TYPE"] = cache_type
os.environ["MARQO_INFERENCE_CACHE_SIZE"] = str(cache_size)

# Reload the module to apply the new environment variables
importlib.reload(sys.modules['marqo.s2_inference.s2_inference'])
from marqo.s2_inference.s2_inference import vectorise
return vectorise

Expand Down

0 comments on commit 2add027

Please sign in to comment.