Skip to content

Commit

Permalink
Added two env vars for enabling query performance
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtuevo committed Oct 10, 2024
1 parent 6f5a12c commit 4aeec32
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 136 deletions.
2 changes: 2 additions & 0 deletions app/packages/relay/src/fragments/configFragment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export default r(graphql`
disableFrameFiltering
gridZoom
lightningThreshold
enableQueryPerformance
defaultQueryPerformance
loopVideos
mediaFallback
multicolorKeypoints
Expand Down
162 changes: 26 additions & 136 deletions app/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ input Aggregate {
histogramValues: HistogramValues = null
}

union AggregateResult =
BooleanAggregation
| DataAggregation
| IntAggregation
| FloatAggregation
| RootAggregation
| StringAggregation
union AggregateResult = BooleanAggregation | DataAggregation | IntAggregation | FloatAggregation | RootAggregation | StringAggregation

interface Aggregation {
path: String!
Expand All @@ -34,14 +28,7 @@ input AggregationForm {
viewName: String = null
}

union AggregationResponses =
CountResponse
| BoolCountValuesResponse
| IntCountValuesResponse
| StrCountValuesResponse
| DatetimeHistogramValuesResponse
| FloatHistogramValuesResponse
| IntHistogramValuesResponse
union AggregationResponses = CountResponse | BoolCountValuesResponse | IntCountValuesResponse | StrCountValuesResponse | DatetimeHistogramValuesResponse | FloatHistogramValuesResponse | IntHistogramValuesResponse

type AppConfig {
colorBy: ColorBy!
Expand All @@ -63,7 +50,6 @@ type AppConfig {
timezone: String
useFrameNumber: Boolean!
spaces: JSON
disableFrameFiltering: Boolean!
mediaFallback: Boolean!
}

Expand Down Expand Up @@ -240,21 +226,22 @@ type Dataset {
estimatedSampleCount: Int!
frameIndexes: [Index!]
sampleIndexes: [Index!]
headName: String
snapshotName: String
stages(slug: String = null, view: BSONArray = null): BSONArray
workspace(slug: String): Workspace
}

type DatasetAppConfig {
colorScheme: ColorScheme
disableFrameFiltering: Boolean
gridMediaField: String!
mediaFields: [String!]
modalMediaField: String!
mediaFallback: Boolean!
plugins: JSON
sidebarGroups: [SidebarGroup!]
sidebarMode: SidebarMode
spaces: JSON
gridMediaField: String!
modalMediaField: String!
mediaFallback: Boolean!
}

type DatasetStrConnection {
Expand Down Expand Up @@ -445,9 +432,7 @@ input LightningInput {
input LightningPathInput {
path: String!

"""
exclude these values from results
"""
"""exclude these values from results"""
exclude: [String!] = null
first: Int = 200
search: String = null
Expand All @@ -457,13 +442,7 @@ interface LightningResult {
path: String!
}

union LightningResults =
BooleanLightningResult
| DateLightningResult
| DateTimeLightningResult
| FloatLightningResult
| IntLightningResult
| StringLightningResult
union LightningResults = BooleanLightningResult | DateLightningResult | DateTimeLightningResult | FloatLightningResult | IntLightningResult | StringLightningResult

type MaskColor {
color: String!
Expand All @@ -489,81 +468,19 @@ type MediaURL {
}

type Mutation {
setColorScheme(
subscription: String!
colorScheme: ColorSchemeInput!
): ColorScheme!
setDatasetColorScheme(
subscription: String!
datasetName: String!
colorScheme: ColorSchemeInput = null
): ColorScheme
setFieldVisibilityStage(
subscription: String!
session: String
stage: BSON
): Boolean!
setDataset(
subscription: String!
session: String
name: String
viewName: String
): Boolean!
setColorScheme(subscription: String!, colorScheme: ColorSchemeInput!): ColorScheme!
setDatasetColorScheme(subscription: String!, datasetName: String!, colorScheme: ColorSchemeInput = null): ColorScheme
setFieldVisibilityStage(subscription: String!, session: String, stage: BSON): Boolean!
setDataset(subscription: String!, session: String, name: String, viewName: String): Boolean!
setGroupSlice(subscription: String!, session: String, slice: String): Boolean!
setSample(
subscription: String!
session: String
groupId: String
id: String
): Boolean!
setSidebarGroups(
subscription: String!
session: String
dataset: String!
stages: BSONArray!
sidebarGroups: [SidebarGroupInput!]!
): Boolean!
setSelected(
subscription: String!
session: String
selected: [String!]!
): Boolean!
setSelectedLabels(
subscription: String!
session: String
selectedLabels: [SelectedLabel!]!
): Boolean!
setView(
subscription: String!
session: String
datasetName: String!
view: BSONArray = null
savedViewSlug: String = null
form: StateForm = null
): BSONArray
createSavedView(
subscription: String!
session: String
viewName: String!
viewStages: BSONArray = null
form: StateForm = null
datasetName: String = null
description: String = null
color: String = null
): SavedView
deleteSavedView(
subscription: String!
session: String
viewName: String!
datasetName: String
): String
updateSavedView(
viewName: String!
subscription: String
session: String
updatedInfo: SavedViewInfo!
datasetName: String = null
): SavedView
setSample(subscription: String!, session: String, groupId: String, id: String): Boolean!
setSidebarGroups(subscription: String!, session: String, dataset: String!, stages: BSONArray!, sidebarGroups: [SidebarGroupInput!]!): Boolean!
setSelected(subscription: String!, session: String, selected: [String!]!): Boolean!
setSelectedLabels(subscription: String!, session: String, selectedLabels: [SelectedLabel!]!): Boolean!
setView(subscription: String!, session: String, datasetName: String!, view: BSONArray = null, savedViewSlug: String = null, form: StateForm = null): BSONArray
createSavedView(subscription: String!, session: String, viewName: String!, viewStages: BSONArray = null, form: StateForm = null, datasetName: String = null, description: String = null, color: String = null): SavedView
deleteSavedView(subscription: String!, session: String, viewName: String!, datasetName: String): String
updateSavedView(viewName: String!, subscription: String, session: String, updatedInfo: SavedViewInfo!, datasetName: String = null): SavedView
setSpaces(subscription: String!, session: String, spaces: BSON!): Boolean!
searchSelectFields(datasetName: String!, metaFilter: JSON): [String!]!
}
Expand All @@ -587,19 +504,9 @@ type PointCloudSample implements Sample {
}

type Query {
aggregate(
datasetName: String!
view: BSONArray
aggregations: [Aggregate!]!
viewName: String = null
form: ExtendedViewForm = null
): [AggregationResponses!]!
aggregate(datasetName: String!, view: BSONArray, aggregations: [Aggregate!]!, viewName: String = null, form: ExtendedViewForm = null): [AggregationResponses!]!
dataset(name: String!, savedViewSlug: String, view: BSONArray = null): Dataset
datasets(
search: String
first: Int = 200
after: String = null
): DatasetStrConnection!
datasets(search: String, first: Int = 200, after: String = null): DatasetStrConnection!
aggregations(form: AggregationForm!): [AggregateResult!]!
lightning(input: LightningInput!): [LightningResults!]!
colorscale: [[Int!]!]
Expand All @@ -608,30 +515,13 @@ type Query {
dev: Boolean!
doNotTrack: Boolean!
estimatedDatasetCount: Int!
samples(
dataset: String!
view: BSONArray!
first: Int = 20
after: String = null
filter: SampleFilter = null
filters: BSON = null
extendedStages: BSON = null
paginationData: Boolean = true
): SampleItemStrConnection!
sample(
dataset: String!
view: BSONArray!
filter: SampleFilter!
filters: JSON = null
): SampleItem
samples(dataset: String!, view: BSONArray!, first: Int = 20, after: String = null, filter: SampleFilter = null, filters: BSON = null, extendedStages: BSON = null, paginationData: Boolean = true): SampleItemStrConnection!
sample(dataset: String!, view: BSONArray!, filter: SampleFilter!, filters: JSON = null): SampleItem
stageDefinitions: [StageDefinition!]!
uid: String!
version: String!
savedViews(datasetName: String!): [SavedView!]
schemaForViewStages(
datasetName: String!
viewStages: BSONArray!
): SchemaResult!
schemaForViewStages(datasetName: String!, viewStages: BSONArray!): SchemaResult!
}

type RootAggregation implements Aggregation {
Expand Down
9 changes: 9 additions & 0 deletions fiftyone/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,21 @@ def __init__(self, d=None):
self.grid_zoom = self.parse_int(
d, "grid_zoom", env_var="FIFTYONE_APP_GRID_ZOOM", default=5
)
# deprecate lightning threshold in favor of a timer-based approach
self.lightning_threshold = self.parse_int(
d,
"lightning_threshold",
env_var="FIFTYONE_APP_LIGHTNING_THRESHOLD",
default=None,
)
self.enable_query_performance = self.parse_bool(
d, "enable_query_performance",
env_var="FIFTYONE_APP_ENABLE_QUERY_PERFORMANCE", default=True
)
self.default_query_performance = self.parse_bool(
d, "default_query_performance",
env_var="FIFTYONE_APP_DEFAULT_QUERY_PERFORMANCE", default=True
)
self.loop_videos = self.parse_bool(
d,
"loop_videos",
Expand Down
2 changes: 2 additions & 0 deletions fiftyone/server/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ class AppConfig:
colorscale: str
grid_zoom: int
lightning_threshold: t.Optional[int]
enable_query_performance: bool
default_query_performance: bool
loop_videos: bool
multicolor_keypoints: bool
notebook_height: int
Expand Down

0 comments on commit 4aeec32

Please sign in to comment.