Skip to content

Commit

Permalink
Merge pull request voxel51#3765 from voxel51/merge/release_v0.22.3_to…
Browse files Browse the repository at this point in the history
…_main

Merge/release v0.22.3 to main
  • Loading branch information
findtopher authored Nov 3, 2023
2 parents 3d5fe39 + 5affee1 commit 9a93d4f
Show file tree
Hide file tree
Showing 45 changed files with 699 additions and 488 deletions.
74 changes: 30 additions & 44 deletions .github/workflows/build-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,16 @@ on:

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux-aarch64
- linux-i686
- linux-x86_64
- mac-arm64
- mac-x86_64
- win-32
- win-amd64
- sdist
- darwin-arm64
- darwin-x86_64
- windows-32
- windows-x86_64
steps:
- name: Clone fiftyone
uses: actions/checkout@v1
Expand All @@ -40,48 +38,36 @@ jobs:
if [[ $RELEASE_TAG =~ ^refs\/tags\/db-v.*-rc\..*$ ]]; then
echo "RELEASE_VERSION=$(echo "${{ github.ref }}" | sed "s/^refs\/tags\/db-v//")" >> $GITHUB_ENV
fi
- name: Build wheel
run: |
cd package/db
python setup.py bdist_wheel --plat-name ${{ matrix.platform }}
- name: Build wheel (macOS Arm64)
if: ${{ matrix.platform == 'mac-arm64' }}
- name: Build Darwin arm64 wheel
if: ${{ matrix.platform == 'darwin-arm64' }}
run: |
cd package/db
python setup.py bdist_wheel --plat-name mac-arm64
- name: Build wheel (Ubuntu 22.04 x86_64)
if: ${{ matrix.platform == 'linux-x86_64' }}
env:
FIFTYONE_DB_BUILD_LINUX_DISTRO: ubuntu2204
FODB_MACHINE=arm64 FODB_SYSTEM=Darwin python setup.py bdist_wheel
- name: Build Darwin x86_64 wheel
if: ${{ matrix.platform == 'darwin-x86_64' }}
run: |
cd package/db
python setup.py bdist_wheel --plat-name linux-x86_64
- name: Build wheel (Ubuntu 20.04 x86_64)
if: ${{ matrix.platform == 'linux-x86_64' }}
env:
FIFTYONE_DB_BUILD_LINUX_DISTRO: ubuntu2004
FODB_MACHINE=x86_64 FODB_SYSTEM=Darwin python setup.py bdist_wheel
- name: Build Windows 32 wheel
if: ${{ matrix.platform == 'windows-32' }}
run: |
cd package/db
python setup.py bdist_wheel --plat-name linux-x86_64
- name: Build wheel (Debian 9 x86_64)
if: ${{ matrix.platform == 'linux-x86_64' }}
env:
FIFTYONE_DB_BUILD_LINUX_DISTRO: debian9
FODB_MACHINE=32 FODB_SYSTEM=Windows python setup.py bdist_wheel
- name: Build Windows x86_64 wheel
if: ${{ matrix.platform == 'windows-x86_64' }}
run: |
cd package/db
python setup.py bdist_wheel --plat-name linux-x86_64
- name: Build wheel (RHEL/CentOS 7 x86_64)
if: ${{ matrix.platform == 'linux-x86_64' }}
env:
FIFTYONE_DB_BUILD_LINUX_DISTRO: rhel7
FODB_MACHINE=x86_64 FODB_SYSTEM=Windows python setup.py bdist_wheel
- name: Build sdist
if: ${{ matrix.platform == 'sdist' }}
run: |
cd package/db
python setup.py bdist_wheel --plat-name linux-x86_64
- name: Upload wheel(s)
python setup.py sdist
- name: Upload
uses: actions/upload-artifact@v2
with:
name: wheel-${{ matrix.platform }}
path: package/db/dist/*.whl
name: dist-${{ matrix.platform }}
path: package/db/dist/*

test:
runs-on: ubuntu-20.04
Expand All @@ -91,14 +77,14 @@ jobs:
steps:
- name: Clone fiftyone
uses: actions/checkout@v1
- name: Download fiftyone-db wheel
- name: Download fiftyone-db
uses: actions/download-artifact@v2
with:
name: wheel-linux-x86_64
name: dist-sdist
path: downloads
- name: Install fiftyone-db
run: |
pip3 install downloads/fiftyone_db-*.whl
pip3 install downloads/fiftyone_db-*.tar.gz
- name: Install test dependencies
run: |
pip3 install pytest
Expand All @@ -108,11 +94,11 @@ jobs:
python3 -m pytest --verbose tests/
publish:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
needs: [build, test]
if: startsWith(github.ref, 'refs/tags/db-v')
steps:
- name: Download wheels
- name: Download
uses: actions/download-artifact@v2
with:
path: downloads
Expand All @@ -130,4 +116,4 @@ jobs:
TWINE_USERNAME: __token__
TWINE_NON_INTERACTIVE: 1
run: |
python -m twine upload downloads/wheel-*/*.whl
python -m twine upload downloads/dist-*/*
1 change: 1 addition & 0 deletions app/packages/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta charset="UTF-8" />
<meta name="description" content="Explore, Analyze, Curate" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="referrer" content="no-referrer" />
<title>FiftyOne</title>
</head>
<body>
Expand Down
1 change: 0 additions & 1 deletion app/packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"react": "18.1.0",
"react-dom": "18.1.0",
"react-error-boundary": "^3.1.4",
"react-ga": "^3.1.2",
"react-hotkeys": "^2.0.0",
"react-input-autosize": "^3.0.0",
"react-is": "^17.0.1",
Expand Down
2 changes: 1 addition & 1 deletion app/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"react-draggable": "^4.4.5",
"react-error-boundary": "^3.1.4",
"react-file-drop": "^3.1.6",
"react-ga": "^3.1.2",
"react-ga4": "^2.1.0",
"react-hotkeys": "^2.0.0",
"react-input-autosize": "^3.0.0",
"react-is": "^17.0.1",
Expand Down
22 changes: 9 additions & 13 deletions app/packages/core/src/Root/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AnimatePresence, motion } from "framer-motion";
import React, { Suspense, useContext, useEffect, useMemo } from "react";
import ReactDOM from "react-dom";
import ReactGA from "react-ga";
import ReactGA from "react-ga4";
import {
PreloadedQuery,
useFragment,
Expand Down Expand Up @@ -35,12 +35,12 @@ import style from "./Root.module.css";

import * as fos from "@fiftyone/state";
import { Route, RouterContext, getDatasetName } from "@fiftyone/state";
import { isElectron } from "@fiftyone/utilities";
import { RootDatasets_query$key } from "./__generated__/RootDatasets_query.graphql";
import { RootGA_query$key } from "./__generated__/RootGA_query.graphql";
import { RootNav_query$key } from "./__generated__/RootNav_query.graphql";
import { RootQuery } from "./__generated__/RootQuery.graphql";

import { isElectron } from "@fiftyone/utilities";
import { DarkMode, LightMode } from "@mui/icons-material";
import { IconButton, useColorScheme } from "@mui/material";
import DatasetSelector from "../components/DatasetSelector";
Expand Down Expand Up @@ -118,24 +118,20 @@ export const useGA = (prepared: PreloadedQuery<RootQuery>) => {
}
const dev = info.dev;
const buildType = dev ? "dev" : "prod";

ReactGA.initialize(gaConfig.app_ids[buildType], {
debug: false,
testMode: false,
gaOptions: {
storage: "none",
cookieDomain: "none",
clientId: info.uid,
page_location: "omitted",
page_path: "omitted",
kind: isElectron() ? "Desktop" : "Web",
version: info.version,
context: info.context,
checkProtocolTask: null, // disable check, allow file:// URLs
},
});
ReactGA.set({
userId: info.uid,
checkProtocolTask: null, // disable check, allow file:// URLs
[gaConfig.dimensions.dev]: buildType,
[gaConfig.dimensions.version]: `${info.version}`,
[gaConfig.dimensions.context]:
info.context + (isElectron() ? "-DESKTOP" : ""),
});
ReactGA.pageview("/");
}, []);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const ModalWrapper = styled.div`
left: 0;
width: 100%;
height: 100%;
z-index: 100000000 !important;
z-index: 1000; // do not set more than 1300 (operator panel)
align-items: center;
display: flex;
justify-content: center;
Expand Down
5 changes: 4 additions & 1 deletion app/packages/core/src/components/Modal/Looker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ const Looker = ({
const initialRef = useRef<boolean>(true);
const lookerOptions = fos.useLookerOptions(true);
const [reset, setReset] = useState(false);
const selectedMediaField = useRecoilValue(fos.selectedMediaField(true));

const createLooker = fos.useCreateLooker(true, false, {
...lookerOptions,
});

const looker = React.useMemo(
() => createLooker.current(sampleData),
[reset, createLooker]
[reset, createLooker, selectedMediaField]
);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion app/packages/core/src/components/Modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ModalWrapper = styled.div`
left: 0;
width: 100%;
height: 100%;
z-index: 10000;
z-index: 1000; // do not set more than 1300 (operator panel)
align-items: center;
display: flex;
justify-content: center;
Expand Down
4 changes: 4 additions & 0 deletions app/packages/core/src/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,10 @@ const InteractiveSidebar = ({
entry.kind !== fos.EntryKind.INPUT
);

if (after === undefined) {
return lastOrder.current;
}

if (after === null) {
return [
...section,
Expand Down
4 changes: 2 additions & 2 deletions app/packages/core/src/ga.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default {
app_ids: {
prod: "UA-141773487-6",
dev: "UA-141773487-7",
prod: "G-NT3FLN0QHF",
dev: "G-7TMZEFFWB7",
},
dimensions: {
dev: "dimension1",
Expand Down
2 changes: 1 addition & 1 deletion app/packages/core/src/utils/generic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const prettify = (
);
}

return v;
return result;
};

export const genSort = (a, b, asc) => {
Expand Down
3 changes: 3 additions & 0 deletions app/packages/operators/src/OperatorCore.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import OperatorBrowser from "./OperatorBrowser";
import OperatorInvocationRequestExecutor from "./OperatorInvocationRequestExecutor";
import OperatorPrompt, { OperatorViewModal } from "./OperatorPrompt";
import { useOperatorPlacementsResolver } from "./hooks";

export default function OperatorCore() {
useOperatorPlacementsResolver();

return (
<>
<OperatorBrowser />
Expand Down
12 changes: 0 additions & 12 deletions app/packages/operators/src/OperatorInvocationRequestExecutor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,10 @@ import {
useInvocationRequestExecutor,
useInvocationRequestQueue,
} from "./state";
import { executeStartupOperators } from "./operators";

let called = false;
async function onMount() {
if (called) return;
called = true;
await executeStartupOperators();
}

export default function OperatorInvocationRequestExecutor() {
const { requests, onSuccess, onError } = useInvocationRequestQueue();

useEffect(() => {
onMount();
}, [onMount]);

return (
<>
{requests.map((queueItem) => (
Expand Down
7 changes: 7 additions & 0 deletions app/packages/operators/src/built-in-operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Operator,
OperatorConfig,
executeOperator,
executeStartupOperators,
listLocalAndRemoteOperators,
loadOperatorsFromServer,
registerOperator,
Expand Down Expand Up @@ -780,9 +781,15 @@ export function registerBuiltInOperators() {
}
}

let startupOperatorsExecuted = false;
export async function loadOperators(datasetName: string) {
registerBuiltInOperators();
// todo: move to better spot
await loadOperatorsFromServer(datasetName);
if (!startupOperatorsExecuted) {
executeStartupOperators();
startupOperatorsExecuted = true;
}
}

function getLayout(layout) {
Expand Down
38 changes: 38 additions & 0 deletions app/packages/operators/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useEffect, useRef, useState } from "react";
import { useRecoilValue, useSetRecoilState } from "recoil";
import { isEqual } from "lodash";
import {
ExecutionContext,
fetchRemotePlacements,
resolveLocalPlacements,
} from "./operators";
import { operatorPlacementsAtom, operatorThrottledContext } from "./state";

export function useOperatorPlacementsResolver() {
const context = useRecoilValue(operatorThrottledContext);
const setOperatorPlacementsAtom = useSetRecoilState(operatorPlacementsAtom);
const [resolving, setResolving] = useState(false);
const lastContext = useRef(null);

useEffect(() => {
async function updateOperatorPlacementsAtom() {
setResolving(true);
try {
const ctx = new ExecutionContext({}, context);
const remotePlacements = await fetchRemotePlacements(ctx);
const localPlacements = await resolveLocalPlacements(ctx);
const placements = [...remotePlacements, ...localPlacements];
setOperatorPlacementsAtom(placements);
} catch (error) {
console.error(error);
}
setResolving(false);
}
if (!isEqual(lastContext.current, context) && context?.datasetName) {
lastContext.current = context;
updateOperatorPlacementsAtom();
}
}, [context, setOperatorPlacementsAtom]);

return { resolving };
}
Loading

0 comments on commit 9a93d4f

Please sign in to comment.