Skip to content

Commit

Permalink
chore(copilot): add new bug (#1256)
Browse files Browse the repository at this point in the history
bruh
  • Loading branch information
roaga authored Oct 10, 2024
1 parent 1147698 commit 4b7da64
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/celery_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from celery_app.app import celery_app as celery # noqa: F401
from celery_app.config import CeleryQueues
from seer.automation.autofix.tasks import check_and_mark_recent_autofix_runs
from seer.automation.tasks import delete_data_for_ttl, raise_an_exception
from seer.automation.tasks import buggy_code, delete_data_for_ttl
from seer.configuration import AppConfig
from seer.dependency_injection import inject, injected

Expand All @@ -28,7 +28,7 @@ def setup_periodic_tasks(sender, config: AppConfig = injected, **kwargs):
# TODO remove this task, it's just for testing in prod; throws an error every minute
sender.add_periodic_task(
crontab(minute="*", hour="*"),
raise_an_exception.signature(kwargs={}, queue=CeleryQueues.DEFAULT),
buggy_code.signature(kwargs={}, queue=CeleryQueues.DEFAULT),
name="Intentionally raise an error",
)

Expand Down
18 changes: 10 additions & 8 deletions src/seer/automation/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@


@celery_app.task(time_limit=30)
def raise_an_exception():
import random

for i in range(10):
random_int = random.randint(0, 2)

result = 5 / random_int
logger.info(f"Result of 5 divided by {random_int} is {result}")
def buggy_code():
user_data = [
{"name": "Alice", "age": 30},
{"name": "Bob", "age": "25"},
{"name": "Charlie", "age": None},
{"name": "David", "age": 40},
]

for user in user_data:
print(user["age"] * 12) # type: ignore[index]


@celery_app.task(time_limit=30)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_detected_celery_jobs():
"seer.automation.codegen.unittest_step.unittest_task",
"seer.automation.tasks.delete_data_for_ttl",
"seer.smoke_test.smoke_test",
"seer.automation.tasks.raise_an_exception", # TODO remove this once testing in prod is done
"seer.automation.tasks.buggy_code", # TODO remove this once testing in prod is done
]
)

Expand Down

0 comments on commit 4b7da64

Please sign in to comment.