Skip to content

Commit

Permalink
Merge branch 'develop' into 2022
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminpkane committed Jan 12, 2022
2 parents 9e95e10 + 1205c6c commit a77ec2d
Showing 6 changed files with 52 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build-db.yml
Original file line number Diff line number Diff line change
@@ -17,9 +17,11 @@ jobs:
matrix:
platform:
- linux-aarch64
- linux-i686
- linux-x86_64
- mac-arm64
- mac-x86_64
- win-32
- win-amd64
steps:
- name: Clone fiftyone
26 changes: 17 additions & 9 deletions fiftyone/core/odm/database.py
Original file line number Diff line number Diff line change
@@ -82,15 +82,23 @@ def establish_db_conn(config):
os.environ["FIFTYONE_PRIVATE_DATABASE_PORT"] = str(port)

except fos.ServiceExecutableNotFound as error:
if not fou.is_arm_mac():
raise error

raise FiftyOneConfigError(
"MongoDB is not yet supported on Apple Silicon Macs. Please"
"define a `database_uri` in your"
"`fiftyone.core.config.FiftyOneConfig` to define a connection"
"to your own MongoDB instance or cluster"
)
if fou.is_32_bit():
raise FiftyOneConfigError(
"MongoDB is not supported on 32-bit systems. Please "
"define a `database_uri` in your "
"`fiftyone.core.config.FiftyOneConfig` to define a "
"connection to your own MongoDB instance or cluster "
)

if fou.is_arm_mac():
raise FiftyOneConfigError(
"MongoDB is not yet supported on Apple Silicon Macs. "
"Please define a `database_uri` in your "
"`fiftyone.core.config.FiftyOneConfig` to define a "
"connection to your own MongoDB instance or cluster"
)

raise error

_client = pymongo.MongoClient(**_connection_kwargs)
_validate_db_version(config, _client)
10 changes: 10 additions & 0 deletions fiftyone/core/utils.py
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import os
import platform
import signal
import struct
import subprocess
import timeit
import types
@@ -1238,6 +1239,15 @@ def is_arm_mac():
)


def is_32_bit():
"""Determines whether the system is 32-bit.
Returns:
True/False
"""
return struct.calcsize("P") * 8 == 32


def datetime_to_timestamp(dt):
"""Converts a `datetime.date` or `datetime.datetime` to milliseconds since
epoch.
12 changes: 9 additions & 3 deletions package/db/setup.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
import tarfile
import zipfile

from setuptools import setup, find_packages
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel

try:
@@ -26,9 +26,11 @@
# arm64 is not available for ubuntu1604 and debian9
MONGODB_DOWNLOAD_URLS = {
"linux-aarch64": "https://fastdl.mongodb.org/linux/mongodb-linux-aarch64-ubuntu1804-4.4.2.tgz",
"linux-i686": None,
"linux-x86_64": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.4.2.tgz",
"mac-arm64": None,
"mac-x86_64": "https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.4.2.tgz",
"win-32": None,
"win-amd64": "https://fastdl.mongodb.org/windows/mongodb-windows-x86_64-4.4.2.zip",
"debian9": {
"manylinux1_x86_64": "https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-debian92-4.4.2.tgz",
@@ -73,16 +75,20 @@ def finalize_options(self):
not isa or platform.endswith(isa)
)

if is_platform("linux", "aarch64"):
if is_platform("linux", "i686"):
self.plat_name = "manylinux1_i686"
elif is_platform("linux", "aarch64"):
self.plat_name = "manylinux2014_aarch64"
elif is_platform("linux", "x86_64"):
self.plat_name = "manylinux1_x86_64"
elif is_platform("mac", "arm64"):
self.plat_name = "macosx_11_0_arm64"
elif is_platform("mac", "x86_64"):
self.plat_name = "macosx_10_13_x86_64"
elif is_platform("win"):
elif is_platform("win", "amd64"):
self.plat_name = "win_amd64"
elif is_platform("win", "32"):
self.plat_name = "win32"
else:
raise ValueError(
"Unsupported target platform: %r" % self.plat_name
6 changes: 6 additions & 0 deletions tests/isolated/service_tests.py
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import unittest

import psutil
import pytest
import requests
import retrying

@@ -24,6 +25,10 @@

MONGOD_EXE_NAME = fos.DatabaseService.MONGOD_EXE_NAME

skipwindows = pytest.mark.skipif(
os.name == "nt", reason="Windows hangs in workflows, fix me"
)


def get_child_processes(process=psutil.Process()):
return process.children(recursive=True)
@@ -156,6 +161,7 @@ def run_code(self, code):
"""


@skipwindows
def test_db():
with cleanup_subprocesses(strict=True):
db = fos.DatabaseService()
16 changes: 8 additions & 8 deletions tests/unittests/view_tests.py
Original file line number Diff line number Diff line change
@@ -589,11 +589,11 @@ def test_str(self):
def test_dates(self):
dataset = fo.Dataset()

date1 = date(1970, 1, 1)
date2 = date(1970, 1, 2)
date3 = date(1970, 1, 3)
date1 = date(1970, 1, 2)
date2 = date(1970, 1, 3)
date3 = date(1970, 1, 4)

query_date = datetime(1970, 1, 2, 1, 0, 0)
query_date = datetime(1970, 1, 3, 1, 0, 0)
query_delta = timedelta(hours=2)

dataset.add_samples(
@@ -626,11 +626,11 @@ def test_dates(self):
def test_datetimes(self):
dataset = fo.Dataset()

date1 = datetime(1970, 1, 1, 1, 0, 0)
date2 = datetime(1970, 1, 1, 2, 0, 0)
date3 = datetime(1970, 1, 1, 3, 0, 0)
date1 = datetime(1970, 1, 1, 2, 0, 0)
date2 = datetime(1970, 1, 1, 3, 0, 0)
date3 = datetime(1970, 1, 1, 4, 0, 0)

query_date = datetime(1970, 1, 1, 2, 1, 0)
query_date = datetime(1970, 1, 1, 3, 1, 0)
query_delta = timedelta(minutes=30)

dataset.add_samples(

0 comments on commit a77ec2d

Please sign in to comment.