Merge branch 'staging/maintenance' into maintenance

This commit is contained in:
Gina Häußge committed 2020-07-13 14:27:30 +02:00
commit 63135a4b2b
8 files changed
+105 -75

No files matched your search

+47 -47
View File
@@ -90,52 +90,52 @@ jobs:
run: |
pip install dist/OctoPrint-*.tar.gz
test-e2e:
name: 🧪 E2E tests
needs: build
runs-on: ubuntu-16.04
steps:
- name: ⬇ Checkout code
uses: actions/checkout@v2
- name: ⬇ Download build result
uses: actions/download-artifact@v1
with:
name: dist
path: dist
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: 🚀 Install wheel
run: |
pip install dist/OctoPrint-*-py2.py3-none-any.whl
- name: 🏗 Create base config for test server
run: |
mkdir e2econfig
cp -r .github/fixtures/with_acl/* e2econfig
- name: 🚀 Run Cypress
uses: cypress-io/github-action@v2
with:
working-directory: tests/cypress
browser: chrome
start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
wait-on: 'http://127.0.0.1:5000/online.txt'
- name: ⬆ Upload screenshots
uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: tests/cypress/screenshots
- name: ⬆ Upload videos
uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: tests/cypress/videos
#test-e2e:
# name: 🧪 E2E tests
# needs: build
# runs-on: ubuntu-16.04
# steps:
# - name: ⬇ Checkout code
# uses: actions/checkout@v2
#
# - name: ⬇ Download build result
# uses: actions/download-artifact@v1
# with:
# name: dist
# path: dist
# - name: 🏗 Set up Python 3.7
# uses: actions/setup-python@v1
# with:
# python-version: 3.7
# - name: 🚀 Install wheel
# run: |
# pip install dist/OctoPrint-*-py2.py3-none-any.whl
#
# - name: 🏗 Create base config for test server
# run: |
# mkdir e2econfig
# cp -r .github/fixtures/with_acl/* e2econfig
#
# - name: 🚀 Run Cypress
# uses: cypress-io/github-action@v2
# with:
# working-directory: tests/cypress
# browser: chrome
# start: 'octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000'
# wait-on: 'http://127.0.0.1:5000/online.txt'
#
# - name: ⬆ Upload screenshots
# uses: actions/upload-artifact@v1
# if: failure()
# with:
# name: cypress-screenshots
# path: tests/cypress/screenshots
# - name: ⬆ Upload videos
# uses: actions/upload-artifact@v1
# if: always()
# with:
# name: cypress-videos
# path: tests/cypress/videos
publish-on-testpypi:
name: 📦 Publish on TestPyPI
@@ -143,7 +143,7 @@ jobs:
needs:
- test-unit
- test-install
- test-e2e
#- test-e2e
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
+5 -1
View File
@@ -283,10 +283,14 @@ The following settings are only relevant to you if you want to do OctoPrint deve
# false, no minification will take place regardless of the minify setting below.
bundle: true
# If set to true, OctoPrint will minify its viewmodels (that includes those of plugins). Note: if bundle is
# If set to true, OctoPrint will the core and library javascript assets. Note: if bundle is
# set to false, no minification will take place either.
minify: true
# If set to true, OctoPrint will also minify the third party plugin javascript assets. Note: if bundle or
# minify are set to false, no minification of the plugin assets will take place either.
minify_plugins: false
# Whether to delete generated web assets on server startup (forcing a regeneration)
clean_on_startup: true
+7 -3
View File
@@ -1605,7 +1605,11 @@ class Server(object):
filters.append("rjsmin")
filters.append("gzip")
js_filters = js_plugin_filters = filters
js_filters = filters
if self._settings.getBoolean(["devel", "webassets", "minify_plugins"]):
js_plugin_filters = js_filters
else:
js_plugin_filters = [x for x in js_filters if x not in ("rjsmin",)]
def js_bundles_for_plugins(collection, filters=None):
"""Produces JsPluginBundle instances that output IIFE wrapped assets"""
@@ -1645,7 +1649,7 @@ class Server(object):
js_app_bundle = Bundle(js_plugins_bundle, js_core_bundle,
output="webassets/packed_app.js",
filters=",".join(js_filters))
filters=",".join(js_plugin_filters))
js_client_core_bundle = Bundle(*clientjs_core,
output="webassets/packed_client_core.js",
@@ -1660,7 +1664,7 @@ class Server(object):
js_client_bundle = Bundle(js_client_core_bundle, js_client_plugins_bundle,
output="webassets/packed_client.js",
filters=",".join(js_filters))
filters=",".join(js_plugin_filters))
# -- CSS -------------------------------------------------------------------------------------------------------
+5 -3
View File
@@ -145,7 +145,8 @@ def getSettings():
"baudrateOptions": connectionOptions["baudrates"],
"autoconnect": s.getBoolean(["serial", "autoconnect"]),
"timeoutConnection": s.getFloat(["serial", "timeout", "connection"]),
"timeoutDetection": s.getFloat(["serial", "timeout", "detection"]),
"timeoutDetectionFirst": s.getFloat(["serial", "timeout", "detectionFirst"]),
"timeoutDetectionConsecutive": s.getFloat(["serial", "timeout", "detectionConsecutive"]),
"timeoutCommunication": s.getFloat(["serial", "timeout", "communication"]),
"timeoutCommunicationBusy": s.getFloat(["serial", "timeout", "communicationBusy"]),
"timeoutTemperature": s.getFloat(["serial", "timeout", "temperature"]),
@@ -442,8 +443,9 @@ def _saveSettings(data):
if "baudrate" in data["serial"]: s.setInt(["serial", "baudrate"], data["serial"]["baudrate"])
if "exclusive" in data["serial"]: s.setBoolean(["serial", "exclusive"], data["serial"]["exclusive"])
if "timeoutConnection" in data["serial"]: s.setFloat(["serial", "timeout", "connection"], data["serial"]["timeoutConnection"], min=1.0)
if "timeoutDetection" in data["serial"]: s.setFloat(["serial", "timeout", "detection"], data["serial"]["timeoutDetection"], min=1.0)
if "timeoutCommunication" in data["serial"]: s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunication"], min=1.0)
if "timeoutDetectionFirst" in data["serial"]: s.setFloat(["serial", "timeout", "detectionFirst"], data["serial"]["timeoutDetectionFirst"], min=1.0)
if "timeoutDetectionConsecutive" in data["serial"]: s.setFloat(["serial", "timeout", "detectionConsecutive"], data["serial"]["timeoutDetectionConsecutive"], min=1.0)
if "timeoutCommunication" in data["serial"]: s.setFloat(["serial", "timeout", "communication"], data["serial"]["timeoutCommunicationFirst"], min=1.0)
if "timeoutCommunicationBusy" in data["serial"]: s.setFloat(["serial", "timeout", "communicationBusy"], data["serial"]["timeoutCommunicationBusy"], min=1.0)
if "timeoutTemperature" in data["serial"]: s.setFloat(["serial", "timeout", "temperature"], data["serial"]["timeoutTemperature"], min=1.0)
if "timeoutTemperatureTargetSet" in data["serial"]: s.setFloat(["serial", "timeout", "temperatureTargetSet"], data["serial"]["timeoutTemperatureTargetSet"], min=1.0)
+4 -2
View File
@@ -98,7 +98,8 @@ default_settings = {
"autoconnect": False,
"log": False,
"timeout": {
"detection": 1,
"detectionFirst": 10,
"detectionConsecutive": 2,
"connection": 10,
"communication": 30,
"communicationBusy": 3,
@@ -414,7 +415,8 @@ default_settings = {
"webassets": {
"bundle": True,
"clean_on_startup": True,
"minify": True
"minify": True,
"minify_plugins": False
},
"useFrozenDictForPrinterState": True,
"showLoadingAnimation": True,
@@ -158,7 +158,8 @@ $(function() {
self.serial_baudrateOptions = ko.observableArray([]);
self.serial_autoconnect = ko.observable(undefined);
self.serial_timeoutConnection = ko.observable(undefined);
self.serial_timeoutDetection = ko.observable(undefined);
self.serial_timeoutDetectionFirst = ko.observable(undefined);
self.serial_timeoutDetectionConsecutive = ko.observable(undefined);
self.serial_timeoutCommunication = ko.observable(undefined);
self.serial_timeoutCommunicationBusy = ko.observable(undefined);
self.serial_timeoutTemperature = ko.observable(undefined);
@@ -173,14 +173,25 @@
</div>
</div>
</div>
<div class="control-group" title="{{ _('Time after which to consider an auto detection attempt to have failed if no successful connection is detected')|edq }}">
<label class="control-label" for="settings-serialTimeoutDetection">{{ _('Autodetection timeout') }}</label>
<div class="control-group" title="{{ _('Time after which to consider the auto detection handshake attempt to have failed if no successful connection is detected')|edq }}">
<label class="control-label" for="settings-serialTimeoutDetectionFirst">{{ _('Autodetection timeout') }}</label>
<div class="controls">
<div class="input-append">
<input type="number" step="any" min="1" class="input-mini text-right" data-bind="value: serial_timeoutDetection" id="settings-serialTimeoutDetection">
<input type="number" step="any" min="1" class="input-mini text-right" data-bind="value: serial_timeoutDetectionFirst" id="settings-serialTimeoutDetectionFirst">
<span class="add-on">s</span>
</div>
<span class="help-inline">{{ _('First handshake attempt')}}</span>
</div>
<div class="controls">
<div class="input-append">
<input type="number" step="any" min="1" class="input-mini text-right" data-bind="value: serial_timeoutDetectionConsecutive" id="settings-serialTimeoutDetectionConsecutive">
<span class="add-on">s</span>
</div>
<span class="help-inline">{{ _('Consecutive handshake attempts')}}</span>
</div>
</div>
<div class="control-group" title="{{ _('Time after which to consider further auto detection attempts to have failed if no successful connection is detected')|edq }}">
<label class="control-label" for="settings-serialTimeoutDetectionConsecutive">{{ _('Autodetection timeout (further tries)') }}</label>
</div>
<div class="control-group" title="{{ _('Time after which to consider a position query on pause or cancel to have failed')|edq }}">
<label class="control-label" for="settings-serialTimeoutPositionLogWait">{{ _('Position query timeout') }}</label>
+21 -15
View File
@@ -1677,15 +1677,14 @@ class MachineCom(object):
return
try_hello = not settings().getBoolean(["serial", "waitForStartOnConnect"])
self._changeState(self.STATE_CONNECTING)
self._timeout = self._ok_timeout = self._get_new_communication_timeout()
else:
self._changeState(self.STATE_DETECT_SERIAL)
self._perform_detection_step(init=True)
# Start monitoring the serial port
self._log("Connected to: %s, starting monitor" % self._serial)
#Start monitoring the serial port.
self._timeout = self._ok_timeout = self._get_new_communication_timeout()
startSeen = False
supportRepetierTargetTemp = settings().getBoolean(["serial", "repetierTargetTemp"])
supportWait = settings().getBoolean(["serial", "supportWait"])
@@ -1874,7 +1873,8 @@ class MachineCom(object):
and (not self.job_on_hold or self._resendActive)
and not self._long_running_command
and not self._heating and now >= self._ok_timeout)) \
and (not self._blockWhileDwelling or not self._dwelling_until or now > self._dwelling_until):
and (not self._blockWhileDwelling or not self._dwelling_until or now > self._dwelling_until)\
and not self._state in (self.STATE_DETECT_SERIAL,):
# We have two timeout variants:
#
# Variant 1: No line at all received within the communication timeout. This can always happen.
@@ -2253,7 +2253,7 @@ class MachineCom(object):
### Serial detection
if self._state == self.STATE_DETECT_SERIAL:
if line == '' or monotonic_time() > self._timeout:
if line == '' or monotonic_time() > self._ok_timeout:
self._perform_detection_step()
elif 'start' in line or line.startswith('ok'):
self._onConnected()
@@ -2412,7 +2412,6 @@ class MachineCom(object):
self._logger.info("Serial detection: {}".format(message))
if init:
timeout = settings().getFloat(["serial", "timeout", "connection"])
port = self._port
baudrate = self._baudrate
@@ -2431,27 +2430,26 @@ class MachineCom(object):
baudrate_candidates = baudrateList([115200, 250000])
self._detection_candidates = [(p, b) for p in port_candidates for b in baudrate_candidates]
self._detection_retry = self.DETECTION_RETRIES
log("Performing autodetection with {} " \
"port/baudrate candidates: {}".format(len(self._detection_candidates),
", ".join(map(lambda x: "{}@{}".format(x[0], x[1]),
self._detection_candidates))))
else:
timeout = settings().getFloat(["serial", "timeout", "detection"])
def attempt_handshake():
timeout = self._get_communication_timeout_interval()
if self._serial.timeout != timeout:
self._serial.timeout = timeout
self._timeout = monotonic_time() + timeout
self._timeout = self._ok_timeout = monotonic_time() + timeout
log("Handshake attempt #{}".format(self._detection_retry + 1))
log("Handshake attempt #{} with timeout {}s".format(self._detection_retry + 1, timeout))
self._detection_retry += 1
self._do_send_without_checksum(b"", log=False) # new line to reset things
self.sayHello(tags={"trigger:detection", })
while len(self._detection_candidates) > 0:
while len(self._detection_candidates) > 0 or self._detection_retry < self.DETECTION_RETRIES:
if self._detection_retry < self.DETECTION_RETRIES:
attempt_handshake()
return
@@ -2460,6 +2458,7 @@ class MachineCom(object):
(p, b) = self._detection_candidates.pop(0)
try:
log("Trying port {}, baudrate {}".format(p, b))
if self._serial is None or self._serial.port != p:
if not self._open_serial(p, b, trigger_errors=False):
log("Could not open port {}, baudrate {}, skipping".format(p, b))
@@ -2467,7 +2466,6 @@ class MachineCom(object):
else:
self._serial.baudrate = b
log("Trying port {}, baudrate {}".format(p, b))
self._detection_retry = 0
attempt_handshake()
@@ -2689,6 +2687,15 @@ class MachineCom(object):
return interval
def _get_communication_timeout_interval(self):
# special rules during serial detection
if self._state in (self.STATE_DETECT_SERIAL,):
if self._detection_retry == 0:
# first try
return self._timeout_intervals.get("detectionFirst", 10.0)
else:
# consecutive tries
return self._timeout_intervals.get("detectionConsecutive", 2.0)
# communication timeout
if self._busy_protocol_support:
comm_timeout = self._timeout_intervals.get("communicationBusy", 2.0)
@@ -2910,8 +2917,7 @@ class MachineCom(object):
eventManager().fire(Events.ERROR, {"error": self.getErrorString(), "reason": reason})
if close:
if self._send_m112_on_error and not self.isSdPrinting() and reason not in ("connection",
"autodetect_baudrate",
"autodetect_port"):
"autodetect"):
self._trigger_emergency_stop(close=False)
self.close(is_error=True)