Skip to content

Commit

Permalink
celery delay repro
Browse files Browse the repository at this point in the history
  • Loading branch information
sl0thentr0py committed May 8, 2024
1 parent 7c09dfd commit a0762e2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
4 changes: 2 additions & 2 deletions python/celery/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from tasks import task, try_dividing_by_zero
from celapp import my_task

try_dividing_by_zero.delay()
my_task.delay()
21 changes: 18 additions & 3 deletions python/celery/celapp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
from celery import Celery, signals
import logging
import time
import sentry_sdk
from secrets import token_hex
from celery import Celery, signals


def init_sentry():
sentry_sdk.init(debug=True)


# init_sentry()


app = Celery(
Expand All @@ -8,11 +18,16 @@
include=['tasks'],
)

logger = logging.getLogger(__name__)
logger.error(f"SETUP {token_hex(2)}")

def init_sentry():
sentry_sdk.init(traces_sample_rate=1.0, debug=True)

@app.task
def my_task():
logger.error(f"MY_TASK {token_hex(2)}")


@signals.celeryd_init.connect
# @signals.worker_init.connect
def init_worker(**_kwargs):
init_sentry()
21 changes: 12 additions & 9 deletions python/celery/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
amqp==5.1.1
billiard==4.1.0
celery==5.3.3
-e git+ssh://git@github.com/getsentry/sentry-python.git@7a7867b2fe0ad8b3d7aeea778b2992b1c506509d#egg=sentry_sdk
amqp==5.2.0
async-timeout==4.0.3
billiard==4.2.0
celery==5.3.5
certifi==2023.7.22
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
kombu==5.3.2
prompt-toolkit==3.0.39
kombu==5.3.3
prompt-toolkit==3.0.41
python-dateutil==2.8.2
-e git+ssh://git@github.com/getsentry/sentry-python.git@7a7867b2fe0ad8b3d7aeea778b2992b1c506509d#egg=sentry_sdk
redis==5.0.1
six==1.16.0
typing_extensions==4.8.0
tzdata==2023.3
urllib3==2.0.4
vine==5.0.0
wcwidth==0.2.6
urllib3==2.1.0
vine==5.1.0
wcwidth==0.2.10

0 comments on commit a0762e2

Please sign in to comment.