mirror of
https://github.com/tiqi-group/pydase.git
synced 2025-04-22 09:10:01 +02:00
adds warning when _bound_func has not been bound yet
This might arise when calling the start method of a task which is part of a class that has not been instantiated yet.
This commit is contained in:
parent
12c0c9763d
commit
09fae01985
@ -70,10 +70,7 @@ class Task(pydase.data_service.data_service.DataService, Generic[R]):
|
|||||||
Removes a task from the tasks dictionary, calls the defined
|
Removes a task from the tasks dictionary, calls the defined
|
||||||
callbacks, and logs and re-raises exceptions."""
|
callbacks, and logs and re-raises exceptions."""
|
||||||
|
|
||||||
# removing the finished task from the tasks i
|
|
||||||
self._task = None
|
self._task = None
|
||||||
|
|
||||||
# emit the notification that the task was stopped
|
|
||||||
self._status = TaskStatus.NOT_RUNNING
|
self._status = TaskStatus.NOT_RUNNING
|
||||||
|
|
||||||
exception = task.exception()
|
exception = task.exception()
|
||||||
@ -95,6 +92,9 @@ class Task(pydase.data_service.data_service.DataService, Generic[R]):
|
|||||||
self._status = TaskStatus.RUNNING
|
self._status = TaskStatus.RUNNING
|
||||||
res: Coroutine[None, None, R] = self._bound_func()
|
res: Coroutine[None, None, R] = self._bound_func()
|
||||||
return await res
|
return await res
|
||||||
|
logger.warning(
|
||||||
|
"Cannot start task %r. Function has not been bound yet", self._func_name
|
||||||
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
logger.info("Creating task %r", self._func_name)
|
logger.info("Creating task %r", self._func_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user