Merge branch 'v3-labthings-global-lock' into 'v3'
Enable global locking. Closes #353 and #388 See merge request openflexure/openflexure-microscope-server!570
This commit is contained in:
commit
704e8eff7e
3 changed files with 12 additions and 5 deletions
|
|
@ -190,4 +190,11 @@ def _full_config_from_args(args: Namespace) -> ThingServerConfig:
|
||||||
)
|
)
|
||||||
|
|
||||||
patched_config = load_patched_config(args.config)
|
patched_config = load_patched_config(args.config)
|
||||||
|
if "enable_global_lock" not in patched_config:
|
||||||
|
patched_config["enable_global_lock"] = True
|
||||||
|
if patched_config["enable_global_lock"] is not True:
|
||||||
|
raise ValueError(
|
||||||
|
"OpenFlexure Microscope Server requires `enable_global_lock` to be `true`, "
|
||||||
|
"and it was set to another value in the configuration file."
|
||||||
|
)
|
||||||
return ThingServerConfig(**patched_config)
|
return ThingServerConfig(**patched_config)
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,7 @@ class SmartScanThing(OFMThing):
|
||||||
raise HTTPException(404, "File not found")
|
raise HTTPException(404, "File not found")
|
||||||
return FileResponse(preview_path)
|
return FileResponse(preview_path)
|
||||||
|
|
||||||
@lt.action
|
@lt.action(use_global_lock=False)
|
||||||
def stitch_scan(self, scan_name: str) -> None:
|
def stitch_scan(self, scan_name: str) -> None:
|
||||||
"""Generate a stitched image based on stage position metadata."""
|
"""Generate a stitched image based on stage position metadata."""
|
||||||
scan_data = self._scan_dir_manager.get_scan_data(scan_name)
|
scan_data = self._scan_dir_manager.get_scan_data(scan_name)
|
||||||
|
|
@ -720,7 +720,7 @@ class SmartScanThing(OFMThing):
|
||||||
except SubprocessError as e:
|
except SubprocessError as e:
|
||||||
self.logger.error(f"Stitching failed: {e}", exc_info=e)
|
self.logger.error(f"Stitching failed: {e}", exc_info=e)
|
||||||
|
|
||||||
@lt.action
|
@lt.action(use_global_lock=False)
|
||||||
def download_zip(
|
def download_zip(
|
||||||
self,
|
self,
|
||||||
scan_name: str,
|
scan_name: str,
|
||||||
|
|
@ -732,7 +732,7 @@ class SmartScanThing(OFMThing):
|
||||||
zip_fname = self._scan_dir_manager.zip_scan(scan_name, final_version=True)
|
zip_fname = self._scan_dir_manager.zip_scan(scan_name, final_version=True)
|
||||||
return ZipBlob.from_file(zip_fname)
|
return ZipBlob.from_file(zip_fname)
|
||||||
|
|
||||||
@lt.action
|
@lt.action(use_global_lock=False)
|
||||||
def stitch_all_scans(self) -> None:
|
def stitch_all_scans(self) -> None:
|
||||||
"""Check the list of scans, and stitch any that don't have a DZI associated with it.
|
"""Check the list of scans, and stitch any that don't have a DZI associated with it.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ class BaseStage(lt.Thing):
|
||||||
"StageThings must define their own _estimate_move_duration method"
|
"StageThings must define their own _estimate_move_duration method"
|
||||||
)
|
)
|
||||||
|
|
||||||
@lt.action
|
@lt.action(use_global_lock=False)
|
||||||
def jog(self, stop: bool = False, **kwargs: int) -> None:
|
def jog(self, stop: bool = False, **kwargs: int) -> None:
|
||||||
"""Make a relative move that may be interrupted by a future ``jog``.
|
"""Make a relative move that may be interrupted by a future ``jog``.
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ class BaseStage(lt.Thing):
|
||||||
command: Optional[JogCommand] = first_command
|
command: Optional[JogCommand] = first_command
|
||||||
|
|
||||||
# prevent others using the stage while jogging.
|
# prevent others using the stage while jogging.
|
||||||
with self._hardware_lock:
|
with self._thing_server_interface.hold_global_lock(), self._hardware_lock:
|
||||||
while command is not None:
|
while command is not None:
|
||||||
if command.displacement is not None:
|
if command.displacement is not None:
|
||||||
self._hardware_start_move_relative(command.displacement)
|
self._hardware_start_move_relative(command.displacement)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue