Code cleanup
This commit is contained in:
parent
2bfb988460
commit
994e83dbeb
46 changed files with 261 additions and 318 deletions
|
|
@ -6,12 +6,12 @@ from openflexure_microscope.config import user_settings
|
|||
from openflexure_microscope.rescue.monitor_timeout import launch_timeout_test_process
|
||||
|
||||
|
||||
def check_capture_rebuild(timeout=10):
|
||||
def check_capture_rebuild():
|
||||
logging.info("Loading user settings...")
|
||||
settings = user_settings.load()
|
||||
|
||||
cap_path = str(settings.get("captures", {}).get("paths", {}).get("default"))
|
||||
logging.info(f"Capture path found: {cap_path}")
|
||||
logging.info("Capture path found: %s", cap_path)
|
||||
if not cap_path:
|
||||
logging.error(
|
||||
"No capture path defined in settings. This is unusual for anything other than a first-run. \nFalling back to default path."
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def trace_config_exceptions():
|
|||
default_config = json.load(DEFAULT_CONFIGURATION_FILE_PATH)
|
||||
if not default_config:
|
||||
error_sources.append("default_config_empty")
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
logging.error("Error parsing config:")
|
||||
logging.error(e)
|
||||
error_sources.append("default_config_error")
|
||||
|
|
@ -25,7 +25,7 @@ def trace_config_exceptions():
|
|||
default_settings = json.load(SETTINGS_FILE_PATH)
|
||||
if not default_settings:
|
||||
error_sources.append("default_settings_empty")
|
||||
except Exception as e:
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
logging.error("Error parsing settings:")
|
||||
logging.error(e)
|
||||
error_sources.append("default_settings_error")
|
||||
|
|
@ -37,8 +37,8 @@ def main():
|
|||
error_sources = []
|
||||
logging.info("Attempting default settings and config import...")
|
||||
try:
|
||||
from openflexure_microscope import config
|
||||
except Exception as e:
|
||||
from openflexure_microscope import config as _
|
||||
except Exception as e: # pylint: disable=W0703
|
||||
error_sources.append("config_settings_import_error")
|
||||
logging.error("Error importing config:")
|
||||
logging.error(e)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
#
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
class ServiceMonitor(object):
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ def launch_timeout_test_process(target, args=(), kwargs=None, timeout=10):
|
|||
# If thread is still active
|
||||
if p.is_alive():
|
||||
logging.error(
|
||||
f"Function {target} reached timeout after {timeout} seconds. Terminating."
|
||||
"Function %s reached timeout after %s seconds. Terminating.",
|
||||
target,
|
||||
timeout,
|
||||
)
|
||||
|
||||
# Terminate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue