Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions test-dramatiq/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = "test-dramatiq"
version = "0"
requires-python = ">=3.12"

dependencies = [
"dramatiq>=0.12.0",
"ipdb>=0.13.13",
"redis>=5.2.1",
"sentry-sdk",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
9 changes: 0 additions & 9 deletions test-dramatiq/requirements.txt

This file was deleted.

14 changes: 4 additions & 10 deletions test-dramatiq/run-worker.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
#!/usr/bin/env bash

set -euo pipefail
reset

# Create virtual environment
python -m venv .venv
source .venv/bin/activate

# Install requirements into virtual environment
pip install -r requirements.txt
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# Start a fresh redis server
pkill redis-server || true
sleep 1
rm -rf dump.rdb
redis-server --daemonize yes

# Start dramatiq worker
dramatiq --processes 1 main
uv run dramatiq --processes 1 main
13 changes: 4 additions & 9 deletions test-dramatiq/run.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail
reset

# Create virtual environment
python -m venv .venv
source .venv/bin/activate

# Install requirements into virtual environment
pip install -r requirements.txt
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# Run script that sends task to dramatiq worker
python main.py
uv run python main.py
Comment on lines +5 to +9

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The script installs uv but fails to update the current shell's PATH, causing subsequent uv commands to fail on clean systems.
Severity: HIGH

Suggested Fix

After the uv installation command, either add ~/.local/bin to the PATH for the current session (e.g., export PATH="$HOME/.local/bin:$PATH") or call uv using its full path ($HOME/.local/bin/uv run ...). This ensures the executable is found in the same session it was installed in.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: test-dramatiq/run.sh#L5-L9

Potential issue: On a system where `uv` is not pre-installed, the script installs it to
`~/.local/bin/` but does not update the `PATH` of the current shell session. The
subsequent call to `uv run ...` fails with a 'command not found' error. Because the
script is configured with `set -euo pipefail`, this error causes the script to abort
immediately, making it impossible to run on a clean system. The same issue exists in the
`run-worker.sh` script.

Also affects:

  • test-dramatiq/run-worker.sh:5~14

Did we get this right? 👍 / 👎 to inform future reviews.

Loading