Skip to content

Commit

Permalink
Merge branch 'main' into well-log-viewer--COMMIT_FIX
Browse files Browse the repository at this point in the history
  • Loading branch information
Anders2303 committed Dec 2, 2024
2 parents a490923 + a028574 commit 6e65407
Show file tree
Hide file tree
Showing 49 changed files with 4,811 additions and 1,490 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ in the following folders are changed:
./backend/src
```

If other files are changed through the host operativey system,
If other files are changed through the host operating system,
e.g. typically when a new dependency is added, the relevant component needs to be rebuilt. I.e.
`docker-compose up --build frontend` or `docker-compose up --build backend`.

Expand Down
10 changes: 5 additions & 5 deletions backend_py/primary/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ docker stop $CONTAINER_ID

# Cache data in memory

Sometimes large data sets must to be loaded from external sources. If the user interacts
Sometimes large data sets must be loaded from external sources. If the user interacts
with this data through a series of requests to the backend, it is inefficient to load
the same data every time. Instead the recommended pattern is to load these large data sets
using a separate job container instance bound to the user where it can then easily be cached.

Technically this is done like this:
1) The frontend makes a requests to the (primary) backend as usual.
1) The frontend makes a request to the (primary) backend as usual.
2) The "data demanding endpoints" in the primary backend proxies the request to a separate
job container runnings its own server (also using `FastAPI` as framework).
job container running its own server (also using `FastAPI` as framework).
3) If the user does not already have a job container bound to her/his user ID, the
cloud infrastructure will spin it up (takes some seconds). The job container will
have single-user scope and automatically stop when it has not seen any new requests
Expand All @@ -41,11 +41,11 @@ Technically this is done like this:

Locally during development (single user scenario) there is a single job container
continuously running, started automatically by `docker-compose`.
Except from starting at the same time as the primary backend, not stopping after user
Except for starting at the same time as the primary backend, not stopping after user
inactivity, and being limited by the developer machine resources (CPU / memory),
this job container during development behave similar to the on demand started job containers in cloud.

On route level this is implemented like the following:
At the route level this is implemented like the following:

**In `src/backend/primary`:**
```python
Expand Down
2,446 changes: 1,331 additions & 1,115 deletions frontend/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"@tanstack/react-query-devtools": "^5.4.2",
"@types/geojson": "^7946.0.14",
"@webviz/group-tree-plot": "^1.1.14",
"@webviz/subsurface-viewer": "^0.25.2",
"@webviz/well-log-viewer": "^1.12.7",
"@webviz/subsurface-viewer": "^1.1.1",
"@webviz/well-completions-plot": "^1.5.11",
"animate.css": "^4.1.1",
"axios": "^1.6.5",
Expand Down Expand Up @@ -76,7 +76,7 @@
"postcss": "^8.4.21",
"prettier": "2.8.3",
"sass": "^1.62.0",
"tailwindcss": "^3.2.4",
"tailwindcss": "^3.4.15",
"typescript": "^5.3.3",
"vite": "^5.0.12",
"vite-plugin-checker": "^0.6.0",
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/framework/GuiMessageBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { isDevMode } from "@lib/utils/devMode";
import { Size2D } from "@lib/utils/geometry";
import { Vec2 } from "@lib/utils/vec2";

import { UnsavedChangesAction } from "./types/unsavedChangesAction";

export enum LeftDrawerContent {
ModuleSettings = "ModuleSettings",
ModulesList = "ModulesList",
Expand All @@ -27,6 +29,7 @@ export enum GuiState {
EditDataChannelConnections = "editDataChannelConnections",
RightSettingsPanelWidthInPercent = "rightSettingsPanelWidthInPercent",
AppInitialized = "appInitialized",
NumberOfUnsavedRealizationFilters = "numberOfUnsavedRealizationFilters",
}

export enum GuiEvent {
Expand All @@ -43,6 +46,7 @@ export enum GuiEvent {
DataChannelConnectionsChange = "dataChannelConnectionsChange",
DataChannelNodeHover = "dataChannelNodeHover",
DataChannelNodeUnhover = "dataChannelNodeUnhover",
UnsavedRealizationFilterSettingsAction = "unsavedRealizationFilterSettingsAction",
}

export type GuiEventPayloads = {
Expand Down Expand Up @@ -75,6 +79,9 @@ export type GuiEventPayloads = {
[GuiEvent.DataChannelNodeHover]: {
connectionAllowed: boolean;
};
[GuiEvent.UnsavedRealizationFilterSettingsAction]: {
action: UnsavedChangesAction;
};
};

type GuiStateValueTypes = {
Expand All @@ -87,6 +94,7 @@ type GuiStateValueTypes = {
[GuiState.EditDataChannelConnections]: boolean;
[GuiState.RightSettingsPanelWidthInPercent]: number;
[GuiState.AppInitialized]: boolean;
[GuiState.NumberOfUnsavedRealizationFilters]: number;
};

const defaultStates: Map<GuiState, any> = new Map();
Expand All @@ -98,12 +106,14 @@ defaultStates.set(GuiState.DataChannelConnectionLayerVisible, false);
defaultStates.set(GuiState.DevToolsVisible, isDevMode());
defaultStates.set(GuiState.RightSettingsPanelWidthInPercent, 0);
defaultStates.set(GuiState.AppInitialized, false);
defaultStates.set(GuiState.NumberOfUnsavedRealizationFilters, 0);

const persistentStates: GuiState[] = [
GuiState.LeftSettingsPanelWidthInPercent,
GuiState.DevToolsVisible,
GuiState.RightSettingsPanelWidthInPercent,
GuiState.RightDrawerContent,
GuiState.NumberOfUnsavedRealizationFilters,
];

export class GuiMessageBroker {
Expand Down
Loading

0 comments on commit 6e65407

Please sign in to comment.