-
Notifications
You must be signed in to change notification settings - Fork 119
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
Improve CI run time #2215
base: master
Are you sure you want to change the base?
Improve CI run time #2215
Changes from all commits
0088b0c
215f1a7
52dbe15
dcae9d4
ab7102d
1104558
ea7ca50
2d9a07b
1dc715d
b9aa11d
dbf63ac
31d4657
6ff176b
3a5396b
28ff538
2d21519
b0686fa
b4c3cca
981573b
53e323e
79df70a
ae1abf6
fc0f6b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
from arcticc.pb2.storage_pb2 import EnvironmentConfigsMap | ||
from arcticdb.version_store.helper import add_mongo_library_to_env | ||
from arcticdb.adapters.prefixing_library_adapter_decorator import PrefixingLibraryAdapterDecorator | ||
from arcticdb.util.test import is_pytest_running | ||
|
||
# All storage client libraries to be imported on-demand to speed up start-up of ad-hoc test runs | ||
if TYPE_CHECKING: | ||
|
@@ -28,11 +29,20 @@ | |
log_level = os.getenv("ARCTICDB_mongo_test_fixture_loglevel") | ||
if log_level: | ||
log_level = log_level.upper() | ||
assert log_level in {"DEBUG", "INFO", "WARN", "ERROR"}, \ | ||
"Log level must be one of DEBUG, INFO, WARN, ERROR" | ||
assert log_level in {"DEBUG", "INFO", "WARN", "ERROR"}, "Log level must be one of DEBUG, INFO, WARN, ERROR" | ||
logger.setLevel(getattr(logging, log_level)) | ||
|
||
|
||
def get_mongo_client(mongo_uri: str) -> "MongoClient": | ||
from pymongo import MongoClient | ||
|
||
if is_pytest_running(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Confused, why can't we just always supply the heartbeat? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am greatly reducing the frequency of the heartbeat because we don't really care about it in the testing. |
||
# Avoids some issues with the PyMongo driver during tests cleanup | ||
return MongoClient(mongo_uri, heartbeatFrequencyMS=86400000) | ||
else: | ||
return MongoClient(mongo_uri) | ||
|
||
|
||
class MongoDatabase(StorageFixture): | ||
"""Each fixture is backed by its own Mongo database, to make clean up easier.""" | ||
|
||
|
@@ -50,11 +60,9 @@ def __init__(self, mongo_uri: str, name: Optional[str] = None, client: Optional[ | |
Optionally reusing a client already connected to ``mongo_uri``. | ||
""" | ||
super().__init__() | ||
from pymongo import MongoClient | ||
|
||
assert mongo_uri.startswith("mongodb://") | ||
self.mongo_uri = mongo_uri | ||
self.client = client or MongoClient(mongo_uri) | ||
self.client = client or get_mongo_client(mongo_uri) | ||
if not name: | ||
while True: | ||
logger.debug("Searching for new name") | ||
|
@@ -114,13 +122,11 @@ def __init__(self, data_dir: Optional[str] = None, port=0, executable="mongod"): | |
self._client = None | ||
|
||
def _safe_enter(self): | ||
from pymongo import MongoClient | ||
|
||
cmd = [self._executable, "--port", str(self._port), "--dbpath", self._data_dir] | ||
self._p = GracefulProcessUtils.start(cmd) | ||
self.mongo_uri = f"mongodb://localhost:{self._port}" | ||
wait_for_server_to_come_up(f"http://localhost:{self._port}", "mongod", self._p) | ||
self._client = MongoClient(self.mongo_uri) | ||
self._client = get_mongo_client(self.mongo_uri) | ||
|
||
def __exit__(self, exc_type, exc_value, traceback): | ||
if self._client: | ||
|
@@ -142,6 +148,7 @@ def __str__(self): | |
|
||
def is_mongo_host_running(host): | ||
import requests | ||
|
||
try: | ||
res = requests.get(f"http://{host}") | ||
except requests.exceptions.ConnectionError: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why have you removed this? Might make @vasil-pashov sad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sccache doesn't work with precompiled headers, so this is making the build much slower on Windows.
AFAIK this is used only in the CI, I am correct @vasil-pashov ?