tiqi-group / pydase

A Python library for creating remote control interfaces of Python objects.
https://pydase.readthedocs.io
MIT License
1 stars 1 forks source link

Defining task without autostart fails #158

Closed lmaisenbacherberkeley closed 1 week ago

lmaisenbacherberkeley commented 1 week ago

Describe the bug

Using pydase 0.10.1, defining as task with the @task decorator without autostart (@task() or @task(autostart=False)) leads to failure to start server.

To Reproduce

import asyncio

import pydase
from pydase.task.decorator import task

class MyService(pydase.DataService):
    @task(autostart=False)
    async def my_task(self) -> None:
        while True:
            # Perform some periodic work
            await asyncio.sleep(1)

if __name__ == "__main__":
    service = MyService()
    pydase.Server(service=service).run()

Expected behaviour

Should generate frontend element to start/stop task.

Screenshot/Video

image

Additional context

Defining the task with autostart (@task(autostart=True)) starts the server successfully, generates the start/stop elements, and starts the task.

mosmuell commented 1 week ago

Thanks for the bug report! I will be looking into this shortly.

lmaisenbacherberkeley commented 1 week ago

Confirmed that this is now fixed - thank you for taking care of this so quickly!

mosmuell commented 1 week ago

My pleasure. Thanks for the feedback!