From 2bd8aa00f3d8c3eb40edda3f184abffa41b48c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 20 Jun 2018 20:03:19 +0200 Subject: [PATCH 1/9] Add build status and IRC badge --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b44dfe19e..f957471b2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # OctoPrint [![GitHub version](https://badge.fury.io/gh/foosel%2FOctoPrint.svg)](https://badge.fury.io/gh/foosel%2FOctoPrint) +[![Travis build status](https://img.shields.io/travis/foosel/OctoPrint.svg)](https://travis-ci.org/foosel/OctoPrint) +[![IRC](https://img.shields.io/badge/freenode-%23octoprint-blue.svg)](https://chat.octoprint.org) OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html). @@ -9,6 +11,8 @@ Its website can be found at [octoprint.org](https://octoprint.org/?utm_source=gi The community forum is available at [discourse.octoprint.org](https://discourse.octoprint.org/?utm_source=github&utm_medium=readme). +The official IRC channel is [#octoprint on freenode](https://chat.octoprint.org). Its logs can be found [here](https://freenode.logbot.info/octoprint). + The FAQ can be accessed by following [faq.octoprint.org](https://faq.octoprint.org/?utm_source=github&utm_medium=readme). The documentation is located at [docs.octoprint.org](http://docs.octoprint.org). From 887304fe18e45fbab4b0f93fd6546c39b8a73112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 20 Jun 2018 23:01:23 +0200 Subject: [PATCH 2/9] Some more badges --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f957471b2..fc9f7e0f1 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ # OctoPrint -[![GitHub version](https://badge.fury.io/gh/foosel%2FOctoPrint.svg)](https://badge.fury.io/gh/foosel%2FOctoPrint) + +![GitHub release](https://img.shields.io/github/release/foosel/OctoPrint.svg?colorB=brightgreen) [![Travis build status](https://img.shields.io/travis/foosel/OctoPrint.svg)](https://travis-ci.org/foosel/OctoPrint) -[![IRC](https://img.shields.io/badge/freenode-%23octoprint-blue.svg)](https://chat.octoprint.org) +[![Discourse topics](https://img.shields.io/discourse/https/discourse.octoprint.org/users.svg)](https://discourse.octoprint.org) +[![IRC](https://img.shields.io/badge/chat-on%20irc-brightgreen.svg)](https://chat.octoprint.org) +[![Twitter Follow](https://img.shields.io/twitter/follow/OctoPrint3d.svg?style=social&label=Follow)](https://twitter.com/OctoPrint3d) + OctoPrint provides a snappy web interface for controlling consumer 3D printers. It is Free Software and released under the [GNU Affero General Public License V3](http://www.gnu.org/licenses/agpl.html). From a97b8c2fd993caea2711e0a8842e354bd078a1b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 25 Jun 2018 11:20:31 +0200 Subject: [PATCH 3/9] Sanity check disabled plugin list just in case See https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596 --- .../plugins/pluginmanager/__init__.py | 8 ++++-- src/octoprint/settings.py | 25 +++++++++++-------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/octoprint/plugins/pluginmanager/__init__.py b/src/octoprint/plugins/pluginmanager/__init__.py index 54ae3cb92..06d4cfe80 100644 --- a/src/octoprint/plugins/pluginmanager/__init__.py +++ b/src/octoprint/plugins/pluginmanager/__init__.py @@ -672,7 +672,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, self._console_logger.debug(u"{prefix} {line}".format(**locals())) def _mark_plugin_enabled(self, plugin, needs_restart=False): - disabled_list = list(self._settings.global_get(["plugins", "_disabled"])) + disabled_list = list(self._settings.global_get(["plugins", "_disabled"], + validator=lambda x: isinstance(x, list), + fallback=[])) if plugin.key in disabled_list: disabled_list.remove(plugin.key) self._settings.global_set(["plugins", "_disabled"], disabled_list) @@ -687,7 +689,9 @@ class PluginManagerPlugin(octoprint.plugin.SimpleApiPlugin, self._pending_enable.add(plugin.key) def _mark_plugin_disabled(self, plugin, needs_restart=False): - disabled_list = list(self._settings.global_get(["plugins", "_disabled"])) + disabled_list = list(self._settings.global_get(["plugins", "_disabled"], + validator=lambda x: isinstance(x, list), + fallback=[])) if not plugin.key in disabled_list: disabled_list.append(plugin.key) self._settings.global_set(["plugins", "_disabled"], disabled_list) diff --git a/src/octoprint/settings.py b/src/octoprint/settings.py index 17ed611a3..d1f80d370 100644 --- a/src/octoprint/settings.py +++ b/src/octoprint/settings.py @@ -1424,17 +1424,22 @@ class Settings(object): #~~ getter def get(self, path, **kwargs): - error_on_path = kwargs.get("error_on_path", False) - new_kwargs = dict(kwargs) - if "error_on_path" in new_kwargs: - del new_kwargs["error_on_path"] + error_on_path = kwargs.pop("error_on_path", False) + validator = kwargs.pop("validator", None) + fallback = kwargs.pop("fallback", None) - try: - return self._get_value(path, **new_kwargs) - except NoSuchSettingsPath: - if error_on_path: - raise - return None + def process(): + try: + return self._get_value(path, **kwargs) + except NoSuchSettingsPath: + if error_on_path: + raise + return None + + result = process() + if callable(validator) and not validator(result): + result = fallback + return result def getInt(self, path, **kwargs): minimum = kwargs.pop("min", None) From faff20943fa1a983f2d50b7f7646fd04de703c35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 5 Jul 2018 10:58:45 +0200 Subject: [PATCH 4/9] Capture & log any errors in the state update worker See #2715 --- src/octoprint/printer/standard.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index c1355bbad..ba2d44d4d 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -1305,20 +1305,23 @@ class StateMonitor(object): self._change_event.set() def _work(self): - while True: - self._change_event.wait() + try: + while True: + self._change_event.wait() - now = time.time() - delta = now - self._last_update - additional_wait_time = self._interval - delta - if additional_wait_time > 0: - time.sleep(additional_wait_time) + now = time.time() + delta = now - self._last_update + additional_wait_time = self._interval - delta + if additional_wait_time > 0: + time.sleep(additional_wait_time) - with self._state_lock: - data = self.get_current_data() - self._update_callback(data) - self._last_update = time.time() - self._change_event.clear() + with self._state_lock: + data = self.get_current_data() + self._update_callback(data) + self._last_update = time.time() + self._change_event.clear() + except: + logging.getLogger(__name__).exception("Looks like something crashed inside the state update worker. Please report this on the OctoPrint issue tracker (make sure to include logs!)") def get_current_data(self): with self._progress_lock: From 0834288cfc6ebb2b9d1c9e3bd2c8deb0150124a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Thu, 5 Jul 2018 09:29:43 +0200 Subject: [PATCH 5/9] Fix estimator initialization on SD print start Closes #2715 --- src/octoprint/printer/standard.py | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index ba2d44d4d..6ae36dc50 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -82,6 +82,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self._selectedFile = None self._estimator_factory = PrintTimeEstimator + self._estimator = None analysis_queue_hooks = plugin_manager().get_hooks("octoprint.printer.estimation.factory") for name, hook in analysis_queue_hooks.items(): try: @@ -134,7 +135,17 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): eventManager().subscribe(Events.METADATA_ANALYSIS_FINISHED, self._on_event_MetadataAnalysisFinished) eventManager().subscribe(Events.METADATA_STATISTICS_UPDATED, self._on_event_MetadataStatisticsUpdated) - def _create_estimator(self, job_type): + def _create_estimator(self, job_type=None): + if job_type is None: + with self._selectedFileMutex: + if self._selectedFile is None: + return + + if self._selectedFile["sd"]: + job_type = "sdcard" + else: + job_type = "local" + self._estimator = self._estimator_factory(job_type) #~~ handling of PrinterCallbacks @@ -494,12 +505,6 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): if self._selectedFile is None: return - if self._selectedFile["sd"]: - job_type = "sdcard" - else: - job_type = "local" - - self._create_estimator(job_type) self._fileManager.delete_recovery_data() self._lastProgressReport = None @@ -749,6 +754,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): cleanedPrintTime = self._comm.getCleanedPrintTime() printTimeLeft = printTimeLeftOrigin = None + estimator = self._estimator if progress is not None: progress_int = int(progress * 100) if self._lastProgressReport != progress_int: @@ -761,7 +767,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): elif progress == 1.0: printTimeLeft = 0 printTimeLeftOrigin = None - else: + elif estimator is not None: statisticalTotalPrintTime = None statisticalTotalPrintTimeType = None with self._selectedFileMutex: @@ -770,11 +776,11 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): statisticalTotalPrintTime = self._selectedFile["estimatedPrintTime"] statisticalTotalPrintTimeType = self._selectedFile.get("estimatedPrintTimeType", None) - printTimeLeft, printTimeLeftOrigin = self._estimator.estimate(progress, - printTime, - cleanedPrintTime, - statisticalTotalPrintTime, - statisticalTotalPrintTimeType) + printTimeLeft, printTimeLeftOrigin = estimator.estimate(progress, + printTime, + cleanedPrintTime, + statisticalTotalPrintTime, + statisticalTotalPrintTimeType) return self._dict(completion=progress * 100 if progress is not None else None, filepos=filepos, @@ -1031,6 +1037,8 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): else: eventManager().fire(Events.FILE_DESELECTED) + self._create_estimator() + self._setJobData(full_path, size, sd, user=user) self._stateMonitor.set_state(self._dict(text=self.get_state_string(), flags=self._getStateFlags())) @@ -1039,6 +1047,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback): self.start_print(pos=self._posAfterSelect, user=user) def on_comm_print_job_started(self, suppress_script=False): + self._stateMonitor.trigger_progress_update() payload = self._payload_for_print_job_event() if payload: eventManager().fire(Events.PRINT_STARTED, payload) From f7a3e6a6ee7a51d7faece1431cca321ecbc237e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 6 Jul 2018 12:03:09 +0200 Subject: [PATCH 6/9] Add --no-cache-dir flag to update pip operations Otherwise we might run into some weird infinite loop issues within pip's cache handling under certain circumstances, and we really don't want to risk that in the field. See also #2543 for another issue worked around by this, and pypa/pip#3532 for the core issue --- src/octoprint/plugins/softwareupdate/updaters/pip.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/octoprint/plugins/softwareupdate/updaters/pip.py b/src/octoprint/plugins/softwareupdate/updaters/pip.py index 6372da151..08dfed097 100644 --- a/src/octoprint/plugins/softwareupdate/updaters/pip.py +++ b/src/octoprint/plugins/softwareupdate/updaters/pip.py @@ -80,7 +80,7 @@ def perform_update(target, check, target_version, log_cb=None, online=True, forc install_arg = check["pip"].format(target_version=target_version, target=target_version) logger.debug(u"Target: %s, executing pip install %s" % (target, install_arg)) - pip_args = ["install", install_arg] + pip_args = ["install", install_arg, "--no-cache-dir"] pip_kwargs = dict() if pip_working_directory is not None: pip_kwargs.update(cwd=pip_working_directory) From 6728302bb3b3ee01ffcfe0279448c667da5435c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 6 Jul 2018 12:55:25 +0200 Subject: [PATCH 7/9] Preparing release of 1.3.9rc2 --- CHANGELOG.md | 15 +++++++++++++++ SUPPORTERS.md | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c780ca0c3..12c01b817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # OctoPrint Changelog +## 1.3.9rc2 (2018-07-06) + +### Improvements + + * Add sanity check for disabled plugin list (see also [#2687 (comment)](https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596)). + * Improve logging of exceptions triggered inside the state update worker (see also [#2715](https://github.com/foosel/OctoPrint/issues/2715)). + +### Bug fixes + + * [#2715](https://github.com/foosel/OctoPrint/issues/2715) (regression) - Fix broken estimator initialization on SD print start and resulting crash of the state update worker. + +### More information + + * [Commits](https://github.com/foosel/OctoPrint/compare/1.3.9rc1...1.3.9rc2) + ## 1.3.9rc1 (2018-06-20) ### Note for upgraders running NGINX as reverse proxy: Be sure to configure HTTP protocol version 1.1 diff --git a/SUPPORTERS.md b/SUPPORTERS.md index 3448ce8d2..c6729c741 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -30,10 +30,12 @@ thanks to everyone who contributed! * Jeremiah Avery * Josh Daniels * Joshua Wills + * Justin Kaufman * Kaile Riser * Kale Stedman * Kazuhiro Ogura * Kodama Inc. + * Lewis Newby * LulzBotĀ® * Makespace Madrid * Mark Walker @@ -51,11 +53,10 @@ thanks to everyone who contributed! * Samer Najia * Simon Hallam * Stefan Krister - * Stephane Schittly * Sven Mueller * Symbiotic Devices * Thomas Hatley * Timothy D Hoogland * Trent Shumay -and 1334 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file +and 1332 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file From 798bc2b2252109c617eb7f5e4901428c0c4a8f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 6 Jul 2018 12:55:25 +0200 Subject: [PATCH 8/9] Preparing release of 1.3.9rc2 --- CHANGELOG.md | 15 +++++++++++++++ SUPPORTERS.md | 7 ++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c780ca0c3..12c01b817 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # OctoPrint Changelog +## 1.3.9rc2 (2018-07-06) + +### Improvements + + * Add sanity check for disabled plugin list (see also [#2687 (comment)](https://github.com/foosel/OctoPrint/issues/2687#issuecomment-399797596)). + * Improve logging of exceptions triggered inside the state update worker (see also [#2715](https://github.com/foosel/OctoPrint/issues/2715)). + +### Bug fixes + + * [#2715](https://github.com/foosel/OctoPrint/issues/2715) (regression) - Fix broken estimator initialization on SD print start and resulting crash of the state update worker. + +### More information + + * [Commits](https://github.com/foosel/OctoPrint/compare/1.3.9rc1...1.3.9rc2) + ## 1.3.9rc1 (2018-06-20) ### Note for upgraders running NGINX as reverse proxy: Be sure to configure HTTP protocol version 1.1 diff --git a/SUPPORTERS.md b/SUPPORTERS.md index 3448ce8d2..320f12706 100644 --- a/SUPPORTERS.md +++ b/SUPPORTERS.md @@ -1,7 +1,7 @@ # Supporters Development of this version of OctoPrint wouldn't have been possible without -[financial support by the community](http://octoprint.org/support-octoprint/) - +[the financial support by the community](https://octoprint.org/support-octoprint/) - thanks to everyone who contributed! ## Patreon Patrons @@ -30,10 +30,12 @@ thanks to everyone who contributed! * Jeremiah Avery * Josh Daniels * Joshua Wills + * Justin Kaufman * Kaile Riser * Kale Stedman * Kazuhiro Ogura * Kodama Inc. + * Lewis Newby * LulzBotĀ® * Makespace Madrid * Mark Walker @@ -51,11 +53,10 @@ thanks to everyone who contributed! * Samer Najia * Simon Hallam * Stefan Krister - * Stephane Schittly * Sven Mueller * Symbiotic Devices * Thomas Hatley * Timothy D Hoogland * Trent Shumay -and 1334 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file +and 1332 more wonderful people pledging on the [Patreon campaign](https://patreon.com/foosel)! \ No newline at end of file From e15946ff79d63c431b4088fb93920d86c880375a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 6 Jul 2018 14:34:19 +0200 Subject: [PATCH 9/9] staging/maintenance is now 1.3.9rc3.dev --- .versioneer-lookup | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.versioneer-lookup b/.versioneer-lookup index 5cdf3804e..03672fbbd 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -24,10 +24,10 @@ maintenance 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev fix/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev improve/.* 1.3.9 da2c9632ea54fd1b3c8ae34f8f26bab29dbaf3c6 pep440-dev -# staging/maintenance is currently the branch for preparation of 1.3.7rc5 +# staging/maintenance is currently the branch for preparation of 1.3.9rc2 # so is regressionfix/... -staging/maintenance 1.3.9rc2 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev -regressionfix/.* 1.3.9rc2 fdf0f75ffa5731fee406c6e761e84a9d2b47aa43 pep440-dev +staging/maintenance 1.3.9rc3 fd94fc94a09dd91deeb2f59a6b3b00b37eb1f145 pep440-dev +regressionfix/.* 1.3.9rc3 fd94fc94a09dd91deeb2f59a6b3b00b37eb1f145 pep440-dev # every other branch is a development branch and thus gets resolved to 1.4.0-dev for now .* 1.4.0 7f5d03d0549bcbd26f40e7e4a3297ea5204fb1cc pep440-dev