fix: fetch all model instance after stopping
This commit is contained in:
@@ -17,6 +17,9 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
const logsViewerRef = React.useRef<any>(null);
|
const logsViewerRef = React.useRef<any>(null);
|
||||||
const requestRef = React.useRef<any>(null);
|
const requestRef = React.useRef<any>(null);
|
||||||
const contentRef = React.useRef<any>(null);
|
const contentRef = React.useRef<any>(null);
|
||||||
|
const [params, setParams] = React.useState<any>({
|
||||||
|
follow: true
|
||||||
|
});
|
||||||
|
|
||||||
const handleCancel = useCallback(() => {
|
const handleCancel = useCallback(() => {
|
||||||
logsViewerRef.current?.abort();
|
logsViewerRef.current?.abort();
|
||||||
@@ -94,9 +97,7 @@ const ViewLogsModal: React.FC<ViewModalProps> = (props) => {
|
|||||||
tail={undefined}
|
tail={undefined}
|
||||||
enableScorllLoad={true}
|
enableScorllLoad={true}
|
||||||
isDownloading={false}
|
isDownloading={false}
|
||||||
params={{
|
params={params}
|
||||||
follow: true
|
|
||||||
}}
|
|
||||||
></LogsViewer>
|
></LogsViewer>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -278,6 +278,21 @@ const Models = forwardRef((props, ref) => {
|
|||||||
fetchData({
|
fetchData({
|
||||||
loadingVal: false
|
loadingVal: false
|
||||||
});
|
});
|
||||||
|
// re-align the instance cache with the backend as a backstop, in case a
|
||||||
|
// DELETE watch event for terminated instances was missed
|
||||||
|
getAllModelInstances();
|
||||||
|
});
|
||||||
|
|
||||||
|
// proactively drop a model's instances from the cache when it is stopped, so
|
||||||
|
// a stale (terminating) instance can't linger and show up alongside the new
|
||||||
|
// one after an immediate restart
|
||||||
|
const handleStop = useMemoizedFn(async (modelIds: number[]) => {
|
||||||
|
const idSet = new Set(modelIds);
|
||||||
|
cacheInsDataListRef.current = cacheInsDataListRef.current.filter(
|
||||||
|
(item) => !idSet.has(item.model_id)
|
||||||
|
);
|
||||||
|
setModelInstances(cacheInsDataListRef.current);
|
||||||
|
handleSearchBySilent();
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleSearch = useMemoizedFn(async (params?: any) => {
|
const handleSearch = useMemoizedFn(async (params?: any) => {
|
||||||
@@ -456,7 +471,7 @@ const Models = forwardRef((props, ref) => {
|
|||||||
handleOnToggleExpandAll={createModelsInstanceChunkRequest}
|
handleOnToggleExpandAll={createModelsInstanceChunkRequest}
|
||||||
onViewLogs={cancelRequestsOnPageInactive}
|
onViewLogs={cancelRequestsOnPageInactive}
|
||||||
onCancelViewLogs={handleOnCancelViewLogs}
|
onCancelViewLogs={handleOnCancelViewLogs}
|
||||||
onStop={handleSearchBySilent}
|
onStop={handleStop}
|
||||||
onStart={handleSearchBySilent}
|
onStart={handleSearchBySilent}
|
||||||
onTableSort={handleOnSortChange}
|
onTableSort={handleOnSortChange}
|
||||||
onFilterChange={handleOnFilterChange}
|
onFilterChange={handleOnFilterChange}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const BreakdownTabs: React.FC<{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'users',
|
key: 'users',
|
||||||
label: intl.formatMessage({ id: 'usage.tabs.users' }),
|
label: intl.formatMessage({ id: 'usage.table.users' }),
|
||||||
forceRender: true,
|
forceRender: true,
|
||||||
children: (
|
children: (
|
||||||
<UsersTable
|
<UsersTable
|
||||||
|
|||||||
Reference in New Issue
Block a user