Implemented draft of new background task system
This commit is contained in:
parent
7c121cd142
commit
e4a78046d7
11 changed files with 370 additions and 159 deletions
|
|
@ -6,6 +6,7 @@ from openflexure_microscope.devel import (
|
|||
JsonResponse,
|
||||
request,
|
||||
jsonify,
|
||||
taskify
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ class AutofocusAPI(MicroscopeViewPlugin):
|
|||
dz = payload.param("dz", default=np.linspace(-300, 300, 7), convert=np.array)
|
||||
|
||||
logging.info("Running autofocus...")
|
||||
task = self.microscope.task.start(self.plugin.autofocus, dz)
|
||||
task = taskify(self.plugin.autofocus)(dz)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
return jsonify(task.state), 202
|
||||
|
|
@ -40,9 +41,7 @@ class FastAutofocusAPI(MicroscopeViewPlugin):
|
|||
backlash = 0
|
||||
|
||||
logging.info("Running autofocus...")
|
||||
task = self.microscope.task.start(
|
||||
self.plugin.fast_autofocus, dz, backlash=backlash
|
||||
)
|
||||
task = taskify(self.plugin.fast_autofocus)(dz, backlash=backlash)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
return jsonify(task.state), 202
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from openflexure_microscope.devel import (
|
|||
JsonResponse,
|
||||
request,
|
||||
jsonify,
|
||||
taskify
|
||||
)
|
||||
|
||||
import logging
|
||||
|
|
@ -14,7 +15,7 @@ from .recalibrate_utils import recalibrate_camera, auto_expose_and_freeze_settin
|
|||
class RecalibrateAPIView(MicroscopeViewPlugin):
|
||||
def post(self):
|
||||
logging.info("Starting microscope recalibration...")
|
||||
task = self.microscope.task.start(self.plugin.recalibrate)
|
||||
task = taskify(self.plugin.recalibrate)
|
||||
|
||||
# Return a handle on the autofocus task
|
||||
return jsonify(task.state), 202
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from openflexure_microscope.devel import (
|
|||
request,
|
||||
jsonify,
|
||||
abort,
|
||||
taskify
|
||||
)
|
||||
|
||||
import logging
|
||||
|
|
@ -43,8 +44,7 @@ class TileScanAPI(MicroscopeViewPlugin):
|
|||
tags = payload.param("tags", default=[], convert=list)
|
||||
|
||||
logging.info("Running tile scan...")
|
||||
task = self.microscope.task.start(
|
||||
self.plugin.tile,
|
||||
task = taskify(self.plugin.tile)(
|
||||
basename=filename,
|
||||
temporary=temporary,
|
||||
step_size=step_size,
|
||||
|
|
@ -59,5 +59,5 @@ class TileScanAPI(MicroscopeViewPlugin):
|
|||
tags=tags,
|
||||
)
|
||||
|
||||
# return a handle on the autofocus task
|
||||
# return a handle on the scan task
|
||||
return jsonify(task.state), 202
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue