You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It runs code that existed but does not exist anymore. This weird behavior seems very persistent.
Explanation
Weird behavior persists despite:
I've uninstalled and installed dramatiq
Restarted terminal, editor, flask server, machine
I've deleted the ENTIRE database instance, redis is gone
I've deleted the redis url from my .env
I don't have any other modules named like the modules I run as worker
Deleted all pycache folders, there are no hidden files
The files are auto-saved
With or without git
Same behavior with powershell, command prompt, git bash
Ended all python processes from task manager
dramatiq is installed in virtual envs only, no global
Removed all keys in redis, there are no keys
I've never had a problem like this with flask
And yet, it's like it's holding on to some code.
When I noticed a difference
I create a new virtual env, install dramatiq and redis
First time it works, worker starts
Then I leave the file empty except for a dummy print statement
Running dramatiq worker runs both the print statement as well as the previous code (that was just deleted or commented out)
Also:
When I delete the entire file worker.py, running dramatiq worker throws a standard ModuleNotFoundError: No module named 'worker'
When I recreate the file from scratch with just the print statement, running dramatiq worker has the same weird behavior: it runs the module plus the code that was deleted
This should indicate that this weird caching mechanism is sensitive to file deletion, but not the file editing (so it seems)
So when I create a new virtual env (even if the module name is the same, for example worker), it does not manifest this weird behavior (which I imagine is like saying, it works the first time only)
Running dramatiq --processes 1 worker runs 1 process, it works correctly
More details:
Windows 10.0.22631
python 3.11.9
dramatiq 1.17.0 (with redis)
pip 24.1.2
flask 3.0.3
Procfile does not have worker process
VS Code with virtual env
If this weird caching mechanism persists across terminal, server, machine restart..
If in redis there are no keys associated with dramatiq..
Uninstall dramatiq, killing all python processes, doesn't work either..
What the hell is this? This is madness.
The only thing that seems to show some "expected behavior" is when I first create a new virtual env and run dramatiq the very first time. All subsequent times seem to run non-existent code.
Screenshots
worker.py is just a print statement (it previously had working code for starting a worker)
worker2.py is just a print statement.
Running worker2.py prints "in worker 2" plus whatever code I previously had in worker.py.
Running worker.py prints "in worker 1" plus whatever code I previously had in worker.py.
Sys path
VIRTUAL ENV A
worker2.py
worker.py
Directory structure
VIRTUAL ENV B
Before (first time it works)
After (then it runs both current file and code I've just deleted)
The text was updated successfully, but these errors were encountered:
Problem: dramatiq runs code that doesn't exist.
It runs code that existed but does not exist anymore. This weird behavior seems very persistent.
Explanation
Weird behavior persists despite:
And yet, it's like it's holding on to some code.
When I noticed a difference
dramatiq worker
runs both the print statement as well as the previous code (that was just deleted or commented out)Also:
worker.py
, runningdramatiq worker
throws a standard ModuleNotFoundError: No module named 'worker'dramatiq worker
has the same weird behavior: it runs the module plus the code that was deletedSo when I create a new virtual env (even if the module name is the same, for example worker), it does not manifest this weird behavior (which I imagine is like saying, it works the first time only)
dramatiq --processes 1 worker
runs 1 process, it works correctlyMore details:
If this weird caching mechanism persists across terminal, server, machine restart..
If in redis there are no keys associated with dramatiq..
Uninstall dramatiq, killing all python processes, doesn't work either..
What the hell is this? This is madness.
The only thing that seems to show some "expected behavior" is when I first create a new virtual env and run dramatiq the very first time. All subsequent times seem to run non-existent code.
Screenshots
worker.py
is just a print statement (it previously had working code for starting a worker)worker2.py
is just a print statement.Running
worker2.py
prints "in worker 2" plus whatever code I previously had inworker.py.
Running
worker.py
prints "in worker 1" plus whatever code I previously had inworker.py.
Sys path
VIRTUAL ENV A
worker2.py
worker.py
Directory structure
VIRTUAL ENV B
Before (first time it works)
After (then it runs both current file and code I've just deleted)
The text was updated successfully, but these errors were encountered: