tobymao / saq

Simple Async Queues
https://saq-py.readthedocs.io/en/latest/
MIT License
585 stars 41 forks source link

Conflict with Debuggers #174

Closed aleixrodriala closed 1 month ago

aleixrodriala commented 1 month ago

When trying to run ipdb; ipdb.set_trace() in a task I get the following:

File "/mnt/c/Users/aleix/Documents/GitHub/domain-watcher/app/watcher/fuzzer/url_fuzzer.py", line 134, in check_response_active
    response = Response(response)
  File "/usr/lib/python3.10/bdb.py", line 90, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.10/bdb.py", line 115, in dispatch_line
    if self.quitting: raise BdbQuit
bdb.BdbQuit 

Context:

saq app.tasks.settings --workers 8

  def check_response_active(self, response, signature):
        if not response:
            return False

        import ipdb; ipdb.set_trace()

Is there any way to debug tasks while running the saq queue?

Thanks

tobymao commented 1 month ago

maybe not with the workers settings, but you could use print statements

barakalon commented 1 month ago

For debugging, I wouldn't use the workers setting

aleixrodriala commented 1 month ago

For debugging, I wouldn't use the workers setting

In my case I have a task that goes through multiple stages and from one queue to another, how would you debug this then for example?

Thanks

barakalon commented 1 month ago

saq uses asyncio and one worker should support multiple concurrent tasks. So simply removing that setting should work, unless you’ve got some more complex setup I’m not aware of?