-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use websocket (nchan) instead of ajax polling to refresh data in dashboard #28
base: master
Are you sure you want to change the base?
Conversation
Peuuuur-Noel
commented
May 4, 2024
•
edited
Loading
edited
- Use websocket (nchan) instead of ajax polling to refresh data in dashboard
- All apps usage statuses are no longer sent, only active apps
…shboard - All apps usage statuses are no longer sent, only active apps
Forgot to mention it, but you have to |
|
||
// Restart nchan gpustat if not running when refresh setting set to Yes | ||
$pid = exec('pgrep gpustat'); | ||
if (!$pid && $_POST['UIREFRESH'] == '1' && $gpustat_cfg['UIREFRESH'] != '1') { |
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.
This should be started automatically when you go back to the dashboard so not sure if this is needed. There is a file in var/run called nchan.pid which contains the running nchan processes but would need to confirm the correct way to stop a process.
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.
I thought about it too, but monitor_nchan doesn't restart it if path to gpustat is present in /var/run/nchan.pid
.
I didn't find a proper way to stop a nchan process. The only way to stop a process is by adding :stop
in .page header to nchan attribut, but it's only for a single run. Process killed after 30 seconds.
I made change to remove process path in nchan.pid and stop process itself if refresh set to No. Dashboard will restart it every time if necessary.
Removed code from GPUStatSettings.page and updated here:
gpustat-unraid/src/gpustat/usr/local/emhttp/plugins/gpustat/nchan/gpustat
Lines 106 to 110 in 563471b
// Stop nchan gpustat if refresh setting set to No and remove it from /var/run/nchan.pid | |
if ($gpustat_cfg['UIREFRESH'] != '1') { | |
exec('sed -i "/plugins\/gpustat\/nchan\/gpustat/d" /var/run/nchan.pid'); | |
exit; | |
} |
@@ -113,9 +113,19 @@ private function detectApplication (SimpleXMLElement $process) | |||
} | |||
} | |||
} | |||
$this->pageData[$app . 'using'] = true; |
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.
These would still be required for non multi i.e. pre 6.12 unless same changes are applied to the pages and js as this common for both.
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.
I also updated code for pre 6.12.
Both versions (multigpu and non multigpu) use websocket.
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.
nchan can only be used if os is 6.10 or greater. Not sure if there will be users running pre 6.10 Non multy should use ajax updates for backwards compatibilty.
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.
I will revert it and use ajax polling for non multigpu. Sorry.
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.
I reverted to ajax polling for non multi.
- Update refresh for non multi (Unraid pre 6.12)