Moved to a LabThings dependency for server

This commit is contained in:
jtc42 2020-01-17 15:13:32 +00:00
parent a1223d8b28
commit 36334ed743
65 changed files with 546 additions and 2364 deletions

View file

@ -21,7 +21,7 @@ Tasks are introduced to manage long-running functions in a way that does not blo
the use of tasks, long-running functions would block an HTTP response until the function returns, often
resulting in a timeout.
To prevent this, any function can be offloaded to a background task. This is done through the :py:meth:`openflexure_microscope.common.tasks.taskify`
To prevent this, any function can be offloaded to a background task. This is done through the :py:meth:`labthings.tasks.taskify`
function, by calling ``taskify(<long_running_function>)(*args, **kwargs)``. Internally, the ``tasks`` submodule stores a list
of all requested tasks, which themselves contain a ``state`` dictionary. This dictionary stores the status of the task (if it
is idle, running, error, or success), information about the start and end times, a unique task ID, and the return value of
@ -38,7 +38,7 @@ An example of a long running task may look like:
.. code-block:: python
from openflexure_microscope.plugins import MicroscopeViewPlugin
from openflexure_microscope.common.tasks import taskify
from labthings.tasks import taskify
class MyPlugin(MicroscopeViewPlugin):
def post(self):
@ -63,7 +63,7 @@ the microscope hardware. For example, even if the stage is not actively moving (
within a tile scan), another user should not be able to move the microscope, interrupting the task. Thread locks act
to prevent this.
The camera and stage both contain an instance of :py:class:`openflexure_microscope.common.lock.StrictLock`, named ``lock``.
The camera and stage both contain an instance of :py:class:`labthings.lock.StrictLock`, named ``lock``.
Built-in functions such as capture and move will always acquire this lock for the duration of the function. This ensures
that, for example, simultaneous attemps to move do not occur.
@ -77,7 +77,7 @@ For example, a timelapse plugin may look like:
from openflexure_microscope.api.v1.views import MicroscopeViewPlugin
from openflexure_microscope.api.utilities import JsonResponse
from openflexure_microscope.common.tasks import taskify
from labthings.tasks import taskify
### MICROSCOPE PLUGIN ###