mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-11-22 07:35:26 +08:00
Attempt at making viewer robust to random errors (#429)
* catch more specific errors * reduce complication; simple handle of oom error * lints
This commit is contained in:
1 parent
65ab15b5ce
commit
5469f2e6b8
5 files changed
+125
-8
No files matched your search
@@ -0,0 +1,91 @@
|
||||
import { useContext, useEffect } from 'react';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { WebSocketContext } from '../WebSocket/WebSocket';
|
||||
|
||||
const msgpack = require('msgpack-lite');
|
||||
|
||||
export function LogPanel() {
|
||||
const websocket = useContext(WebSocketContext).socket;
|
||||
const dispatch = useDispatch();
|
||||
const gpu_oom_error_msg = "GPU out of memory";
|
||||
const resolved_msg = "resolved";
|
||||
let local_error = resolved_msg;
|
||||
// connection status indicators
|
||||
|
||||
const set_max_train_util = () => {
|
||||
if (websocket.readyState === WebSocket.OPEN) {
|
||||
dispatch({
|
||||
type: 'write',
|
||||
path: 'renderingState/targetTrainUtil',
|
||||
data: 0.9,
|
||||
});
|
||||
const cmd = 'write';
|
||||
const path = 'renderingState/targetTrainUtil';
|
||||
const data = {
|
||||
type: cmd,
|
||||
path,
|
||||
data: 0.9,
|
||||
};
|
||||
const message = msgpack.encode(data);
|
||||
websocket.send(message);
|
||||
}
|
||||
};
|
||||
|
||||
const set_small_resolution = () => {
|
||||
if (websocket.readyState === WebSocket.OPEN) {
|
||||
dispatch({
|
||||
type: 'write',
|
||||
path: 'renderingState/maxResolution',
|
||||
data: 512,
|
||||
});
|
||||
const cmd = 'write';
|
||||
const path = 'renderingState/maxResolution';
|
||||
const data = {
|
||||
type: cmd,
|
||||
path,
|
||||
data: 512,
|
||||
};
|
||||
const message = msgpack.encode(data);
|
||||
websocket.send(message);
|
||||
}
|
||||
};
|
||||
|
||||
const set_log_message = () => {
|
||||
if (websocket.readyState === WebSocket.OPEN) {
|
||||
dispatch({
|
||||
type: 'write',
|
||||
path: 'renderingState/log_errors',
|
||||
data: resolved_msg,
|
||||
});
|
||||
const cmd = 'write';
|
||||
const path = 'renderingState/log_errors';
|
||||
const data = {
|
||||
type: cmd,
|
||||
path,
|
||||
data: resolved_msg,
|
||||
};
|
||||
const message = msgpack.encode(data);
|
||||
websocket.send(message);
|
||||
}
|
||||
};
|
||||
|
||||
const check_error = useSelector(
|
||||
(state) => {
|
||||
local_error = state.renderingState.log_errors;
|
||||
if(local_error.includes(gpu_oom_error_msg)){
|
||||
console.log(local_error);
|
||||
set_log_message();
|
||||
set_small_resolution();
|
||||
set_max_train_util();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
useEffect(() => {}, [
|
||||
check_error,
|
||||
local_error,
|
||||
]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import SceneNode from '../../SceneNode';
|
||||
import LevaTheme from '../ConfigPanel/leva_theme.json';
|
||||
import CameraPanel from './CameraPanel';
|
||||
import { RenderControls } from '../ConfigPanel/ConfigPanel';
|
||||
import { LogPanel } from '../LogPanel/LogPanel';
|
||||
|
||||
interface TabPanelProps {
|
||||
children: React.ReactNode;
|
||||
@@ -182,7 +183,7 @@ export function BasicTabs(props: BasicTabsProps) {
|
||||
</TabPanel>
|
||||
|
||||
<TabPanel value={value} index={3}>
|
||||
TODO: add a logging panel
|
||||
<LogPanel>TODO: Something maybe?</LogPanel>
|
||||
</TabPanel>
|
||||
</Box>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user