Skip coroutines with arguments instead of raising an exception

This commit is contained in:
Martin Stadler
2024-05-20 17:41:57 +02:00
committed by B108 Rpi Server
parent 46868743c7
commit eacd5bc6b1

View File

@@ -107,12 +107,13 @@ class TaskManager:
method = getattr(self.service, name) method = getattr(self.service, name)
if inspect.iscoroutinefunction(method): if inspect.iscoroutinefunction(method):
if function_has_arguments(method): if function_has_arguments(method):
raise TaskDefinitionError( logger.info(
"Asynchronous functions (tasks) should be defined without " "Asynchronous functions (tasks) should be defined without "
f"arguments. The task '{method.__name__}' has at least one " f"arguments. The task '{method.__name__}' has at least one "
"argument. Please remove the argument(s) from this function to " "argument. Please remove the argument(s) from this function to "
"use it." "use it in the frontend."
) )
continue
# create start and stop methods for each coroutine # create start and stop methods for each coroutine
setattr( setattr(