mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
feat(octoprint): motion and notifs
This commit is contained in:
parent
6bf729ffe9
commit
7fe6d48ff0
11 changed files with 263 additions and 47 deletions
|
|
@ -2,14 +2,14 @@
|
|||
, python3Packages
|
||||
, fetchFromGitHub
|
||||
}: let
|
||||
pname = "OctoPrint-Octorant";
|
||||
version = "1.3.4";
|
||||
in buildPlugin {
|
||||
pname = "OctoPrint-Octorant";
|
||||
inherit version;
|
||||
inherit pname version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "bchanudet";
|
||||
repo = "OctoPrint-Octorant";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-gP79zlJ8gdtpddXOJIMhouSbwXnrSf+c1bURkN/7jvw=";
|
||||
};
|
||||
|
|
|
|||
39
packages/octoprint/prometheus-exporter-deregister.patch
Normal file
39
packages/octoprint/prometheus-exporter-deregister.patch
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
diff --git a/octoprint_prometheus_exporter/__init__.py b/octoprint_prometheus_exporter/__init__.py
|
||||
--- a/octoprint_prometheus_exporter/__init__.py
|
||||
+++ b/octoprint_prometheus_exporter/__init__.py
|
||||
@@ -53,15 +53,22 @@ class PrometheusExporterPlugin(octoprint.plugin.BlueprintPlugin,
|
||||
self.print_completion_timer = None
|
||||
|
||||
def print_deregister_callback(self, label):
|
||||
- if label != '':
|
||||
+ self.print_progress_label = ''
|
||||
+ if label == '':
|
||||
+ return
|
||||
+ try:
|
||||
self.metrics.print_progress.remove(label)
|
||||
self.metrics.print_time_elapsed.remove(label)
|
||||
self.metrics.print_time_est.remove(label)
|
||||
self.metrics.print_time_left_est.remove(label)
|
||||
- self.print_progress_label = ''
|
||||
+ except Exception as err:
|
||||
+ self._logger.warning(err)
|
||||
|
||||
def slice_deregister_callback(self, label):
|
||||
- self.metrics.slice_progress.remove(label)
|
||||
+ try:
|
||||
+ self.metrics.slice_progress.remove(label)
|
||||
+ except Exception as err:
|
||||
+ self._logger.warning(err)
|
||||
|
||||
def print_complete(self):
|
||||
self.metrics.printing_time_total.inc(time.time() - self.print_time_start)
|
||||
@@ -74,7 +81,8 @@ class PrometheusExporterPlugin(octoprint.plugin.BlueprintPlugin,
|
||||
|
||||
self.print_completion_timer = Timer(30, self.print_complete_callback)
|
||||
self.print_completion_timer.start()
|
||||
- Timer(30, lambda: self.print_deregister_callback(self.print_progress_label)).start()
|
||||
+ print_progress_label = self.print_progress_label
|
||||
+ Timer(30, lambda: self.print_deregister_callback(print_progress_label)).start()
|
||||
|
||||
def deactivateMetricsIfOffline(self, payload):
|
||||
if payload['state_id'] == 'OFFLINE':
|
||||
|
|
@ -18,6 +18,10 @@ in buildPlugin {
|
|||
prometheus-client
|
||||
];
|
||||
|
||||
patches = [
|
||||
./prometheus-exporter-deregister.patch
|
||||
];
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/tg44/OctoPrint-Prometheus-Exporter";
|
||||
};
|
||||
|
|
|
|||
23
packages/octoprint/queue.nix
Normal file
23
packages/octoprint/queue.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ buildPlugin
|
||||
, python3Packages
|
||||
, fetchFromGitHub
|
||||
}: let
|
||||
version = "2.0.0";
|
||||
pname = "OctoPrint-Queue";
|
||||
in buildPlugin {
|
||||
inherit pname version;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "chennes";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-uAG6GrUKXUdUTtzmjKWPiHxMa3ekvoLpSIvFMiJI+/8=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
];
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/chennes/OctoPrint-Queue";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue