aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/argaze/DataFeatures.py23
-rw-r--r--src/argaze/__main__.py8
2 files changed, 22 insertions, 9 deletions
diff --git a/src/argaze/DataFeatures.py b/src/argaze/DataFeatures.py
index fa9b52e..32dd0e1 100644
--- a/src/argaze/DataFeatures.py
+++ b/src/argaze/DataFeatures.py
@@ -940,16 +940,29 @@ def PipelineStepImage(method):
"""Define a decorator use into PipelineStepObject class to wrap pipeline step image method."""
@wraps(method)
- def wrapper(self, **kwargs) -> numpy.array:
- """Wrap pipeline step image method."""
+ def wrapper(self, wait: bool = True, **kwargs) -> numpy.array:
+ """Wrap pipeline step image method.
+
+ Parameters:
+ wait: for SharedObject, wait until the object is available else throw a SharedObjectBusy exception.
+ """
# Check shared object instance
if issubclass(type(self), SharedObject):
- # Busy shared object can't return image
- if self.busy():
+ # Wait until the shared object is available if required
+ if wait:
+
+ while self.busy():
+
+ time.sleep(1e-6)
+
+ # Otherwise, busy shared object can't return image
+ else:
+
+ if self.busy():
- raise SharedObjectBusy(f'Can\'t return image because {self.name} is busy.')
+ raise SharedObjectBusy(f'Can\'t return image because {self.name} is busy.')
if kwargs:
diff --git a/src/argaze/__main__.py b/src/argaze/__main__.py
index 2647198..cb8bd01 100644
--- a/src/argaze/__main__.py
+++ b/src/argaze/__main__.py
@@ -154,8 +154,8 @@ def load_context(args):
try:
- # Display context
- display(context.name, context.image(draw_pipeline=draw_pipeline), 0.75, draw_help=draw_help)
+ # Display context if the pipeline is available
+ display(context.name, context.image(wait = False, draw_pipeline=draw_pipeline), 0.75, draw_help=draw_help)
except SharedObjectBusy:
@@ -168,8 +168,8 @@ def load_context(args):
try:
- # Display scene's frame
- display(scene_frame.name, scene_frame.image(), 0.5)
+ # Display scene's frame if available
+ display(scene_frame.name, scene_frame.image(wait = False), 0.5)
except SharedObjectBusy: