-
Notifications
You must be signed in to change notification settings - Fork 29
Encourage coarser mags when annotating a high number of voxels #8961
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
base: master
Are you sure you want to change the base?
Changes from 38 commits
c4ba568
f6074a1
98d45b2
cfae01d
425959b
5819d92
683849c
fa10734
461fc7a
a5fbb91
18fc591
977f391
2012b1b
63c6332
c956a5b
38df61b
63129bb
9e916a2
fd7e73c
a9aa7ad
a9165c5
c6af70d
f8bf436
613f58b
9f22533
1696a6b
b68663f
3a1463f
dc774c1
1edc7e8
64093d5
b00c9c9
5a7d667
401e815
87e68b5
3f61c1a
658c788
7411227
2fcf0b9
8425875
62f6537
b1d5b8b
df150ca
f5bc27f
91ce0e0
7797555
a1c09f8
0fb2b1b
d99173d
a236ebe
44fcad1
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 |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ import type DataCube from "viewer/model/bucket_data_handling/data_cube"; | |
| import { createCompressedUpdateBucketActions } from "viewer/model/bucket_data_handling/wkstore_adapter"; | ||
| import Store from "viewer/store"; | ||
| import { escalateErrorAction } from "../actions/actions"; | ||
| import { pushSaveQueueTransaction } from "../actions/save_actions"; | ||
| import { notifyAboutUpdatedBucketsAction, pushSaveQueueTransaction } from "../actions/save_actions"; | ||
| import type { UpdateActionWithoutIsolationRequirement } from "../sagas/volume/update_actions"; | ||
|
|
||
| // Only process the PushQueue after there was no user interaction (or bucket modification due to | ||
|
|
@@ -155,7 +155,8 @@ class PushQueue { | |
| createCompressedUpdateBucketActions(batch), | ||
| ); | ||
| Store.dispatch(pushSaveQueueTransaction(items)); | ||
|
|
||
| Store.dispatch(notifyAboutUpdatedBucketsAction(items.length)); | ||
| console.log("notify about ", items.length, " items"); | ||
|
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. remove |
||
| this.compressingBucketCount -= batch.length; | ||
| } catch (error) { | ||
| // See other usage of escalateErrorAction for a detailed explanation. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,24 @@ | ||
| import { getUpdateActionLog } from "admin/rest_api"; | ||
| import features from "features"; | ||
| import ErrorHandling from "libs/error_handling"; | ||
| import Toast from "libs/toast"; | ||
| import { sleep } from "libs/utils"; | ||
| import _ from "lodash"; | ||
| import { call, fork, put, takeEvery } from "typed-redux-saga"; | ||
| import type { APIUpdateActionBatch } from "types/api_types"; | ||
| import { getLayerByName, getMappingInfo } from "viewer/model/accessors/dataset_accessor"; | ||
| import { setVersionNumberAction } from "viewer/model/actions/save_actions"; | ||
| import { showManyBucketUpdatesWarningAction } from "viewer/model/actions/annotation_actions"; | ||
| import { | ||
| type NotifyAboutUpdatedBucketsAction, | ||
| setVersionNumberAction, | ||
| } from "viewer/model/actions/save_actions"; | ||
| import { applySkeletonUpdateActionsFromServerAction } from "viewer/model/actions/skeletontracing_actions"; | ||
| import { applyVolumeUpdateActionsFromServerAction } from "viewer/model/actions/volumetracing_actions"; | ||
| import { globalPositionToBucketPositionWithMag } from "viewer/model/helpers/position_converter"; | ||
| import type { Saga } from "viewer/model/sagas/effect-generators"; | ||
| import { select } from "viewer/model/sagas/effect-generators"; | ||
| import { ensureWkReady } from "viewer/model/sagas/ready_sagas"; | ||
| import { Model } from "viewer/singletons"; | ||
| import { Model, Store } from "viewer/singletons"; | ||
| import type { SkeletonTracing, VolumeTracing } from "viewer/store"; | ||
| import { takeEveryWithBatchActionSupport } from "../saga_helpers"; | ||
| import { updateLocalHdf5Mapping } from "../volume/mapping_saga"; | ||
|
|
@@ -31,11 +36,49 @@ export function* setupSavingToServer(): Saga<void> { | |
| yield* takeEvery("INITIALIZE_ANNOTATION_WITH_TRACINGS", setupSavingForAnnotation); | ||
| yield* takeEveryWithBatchActionSupport("INITIALIZE_SKELETONTRACING", setupSavingForTracingType); | ||
| yield* takeEveryWithBatchActionSupport("INITIALIZE_VOLUMETRACING", setupSavingForTracingType); | ||
| yield* takeEvery("WK_READY", watchForNumberOfBucketsInSaveQueue); | ||
| } | ||
|
|
||
| const VERSION_POLL_INTERVAL_COLLAB = 10 * 1000; | ||
| const VERSION_POLL_INTERVAL_READ_ONLY = 60 * 1000; | ||
| const VERSION_POLL_INTERVAL_SINGLE_EDITOR = 30 * 1000; | ||
| const CHECK_NUMBER_OF_BUCKETS_IN_SAVE_QUEUE_INTERVAL = 10 * 1000; | ||
| const CHECK_NUMBER_OF_BUCKETS_SLIDING_WINDOW = 120 * 1000; | ||
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| function* watchForNumberOfBucketsInSaveQueue(): Saga<void> { | ||
| const bucketSaveWarningThreshold = features().bucketSaveWarningThreshold; | ||
| let bucketsForCurrentInterval = 0; | ||
| let currentBuckets: Array<number> = []; | ||
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const bucketCountArrayLength = Math.floor( | ||
| CHECK_NUMBER_OF_BUCKETS_SLIDING_WINDOW / CHECK_NUMBER_OF_BUCKETS_IN_SAVE_QUEUE_INTERVAL, | ||
| ); | ||
| yield* call( | ||
| setInterval, | ||
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| () => { | ||
| const sumOfBuckets = _.sum(currentBuckets); | ||
| console.log( | ||
| "buckets in last interval: ", | ||
| bucketsForCurrentInterval, | ||
| "currentBucketsArray: ", | ||
| currentBuckets, | ||
| "sumOfBuckets: ", | ||
| sumOfBuckets, | ||
|
||
| ); | ||
| if (sumOfBuckets > bucketSaveWarningThreshold) { | ||
| Store.dispatch(showManyBucketUpdatesWarningAction()); | ||
| } | ||
| currentBuckets.push(bucketsForCurrentInterval); | ||
| if (currentBuckets.length > bucketCountArrayLength) { | ||
| currentBuckets.shift(); | ||
| } | ||
| bucketsForCurrentInterval = 0; | ||
| }, | ||
| CHECK_NUMBER_OF_BUCKETS_IN_SAVE_QUEUE_INTERVAL, | ||
| ); | ||
| yield* takeEvery("NOTIFY_ABOUT_UPDATED_BUCKETS", (action: NotifyAboutUpdatedBucketsAction) => { | ||
| bucketsForCurrentInterval += action.count; | ||
| }); | ||
| } | ||
|
|
||
| function* watchForSaveConflicts(): Saga<void> { | ||
| function* checkForNewVersion(): Saga<boolean> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,99 @@ | ||||||||||
| import { Button, Checkbox, type CheckboxChangeEvent, Space } from "antd"; | ||||||||||
| import { useInterval } from "libs/react_helpers"; | ||||||||||
| import Toast from "libs/toast"; | ||||||||||
| import UserLocalStorage from "libs/user_local_storage"; | ||||||||||
| import { useCallback, useEffect, useRef } from "react"; | ||||||||||
| import { useReduxActionListener } from "viewer/model/helpers/listener_helpers"; | ||||||||||
|
|
||||||||||
| const TOO_MANY_BUCKETS_TOAST_KEY = "manyBucketUpdatesWarningToast"; | ||||||||||
| const WARNING_SUPPRESSION_USER_STORAGE_KEY = "suppressBucketWarning"; | ||||||||||
|
|
||||||||||
| export function ManyBucketUpdatesWarning(): React.ReactNode { | ||||||||||
| const notificationAPIRef = useRef(Toast.notificationAPI); | ||||||||||
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| const neverShowAgainRef = useRef(false); | ||||||||||
| const dontShowAgainInThisSessionRef = useRef(false); | ||||||||||
|
|
||||||||||
| useEffect(() => { | ||||||||||
| if (Toast.notificationAPI != null) { | ||||||||||
| notificationAPIRef.current = Toast.notificationAPI; | ||||||||||
| } | ||||||||||
| }, []); | ||||||||||
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||
| useInterval(() => { | ||||||||||
| UserLocalStorage.setItem("suppressBucketWarning", "false"); | ||||||||||
| console.log("resetting suppressBucketWarning to false every 120s for dev purposes"); | ||||||||||
| }, 120 * 1000); //TODO_C dev | ||||||||||
|
||||||||||
| useInterval(() => { | |
| UserLocalStorage.setItem("suppressBucketWarning", "false"); | |
| console.log("resetting suppressBucketWarning to false every 120s for dev purposes"); | |
| }, 120 * 1000); //TODO_C dev |
🤖 Prompt for AI Agents
In frontend/javascripts/viewer/view/components/many_bucket_updates_warning.tsx
around lines 21 to 24, remove the dev-only useInterval that resets
UserLocalStorage.setItem("suppressBucketWarning", "false") every 120s and its
console.log/TODO comment; delete the entire interval block so the suppression
flag is only set by real user actions and not periodically overwritten for
testing, and ensure no lingering TODO/dev comments remain.
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
knollengewaechs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Outdated
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.
Remove dev logging before merge.
The console.log at Line 94 is a dev artifact and should be removed.
Apply this diff:
dontShowAgainInThisSessionRef.current = true;
} else {
- console.log("suppressing warning toast"); //TODO_C dev
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| console.log("suppressing warning toast"); //TODO_C dev | |
| dontShowAgainInThisSessionRef.current = true; | |
| } else { | |
| } |
🤖 Prompt for AI Agents
frontend/javascripts/viewer/view/components/many_bucket_updates_warning.tsx
around line 94: remove the development console.log statement left in the code
("suppressing warning toast")—delete that line so no debug logging remains in
production; run lint/tests and ensure no unused vars or references cause errors
after removal.
Uh oh!
There was an error while loading. Please reload this page.