Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:59
    jovicon commented #1218
  • 02:57
    jovicon commented #1218
  • 02:53
    simonchen1992 commented #3105
  • 02:50
    github-actions[bot] commented #2716
  • 02:49
    codecov[bot] commented #2716
  • 02:48
    codecov[bot] commented #2716
  • 02:46
    codecov[bot] commented #2716
  • 02:46
    codecov[bot] commented #2716
  • 02:46
    pedabraham synchronize #2716
  • 02:46
    github-actions[bot] commented #2716
  • 02:44
    codecov[bot] commented #2716
  • 02:44
    codecov[bot] commented #2716
  • 02:42
    codecov[bot] commented #2716
  • 02:42
    codecov[bot] commented #2716
  • 02:42
    pedabraham synchronize #2716
  • 02:37
    github-actions[bot] commented #2716
  • 02:36
    codecov[bot] commented #2716
  • 02:35
    codecov[bot] commented #2716
  • 02:34
    codecov[bot] commented #2716
  • 02:34
    codecov[bot] commented #2716
euri10
@euri10
I put rabbitmq but tbh I d'm not sure if I get the pros and cons of each one\
betaalpha
@betaalpha_gitlab
@wshayes I have just started using redis+celery
William Hayes
@wshayes
I’ve been using celery/rabbitmq - just finding rabbitmq more difficult to administer than I’d hoped. How is your experience with redis/celery?
I’m just now in the process of implementing a really simple queue/background process using Redis RPOPLPUSH directly to see it that will simplify my services/life/etc. Just finding Celery/… more complex than I need.
betaalpha
@betaalpha_gitlab
I have not yet experimented at a large scale. Presently it is in Proof-of-Concept stage.

var code="@app.get("/long_task", status_code=202) # 202=Accepted
async def long_task():
from backend.workers import tasks
mytask = tasks.long_task.apply_async(kwargs={'num':30})
return {'task_id': mytask.task_id}

@app.get("/long_task/status/{task_id}", status_code=200) # 200=OK
async def long_task_status(task_id: str):
from backend.workers import tasks
result = tasks.long_task.AsyncResult(task_id)
return {'status': result.status}
"

Sorry, new to giiter. How to send code part?
:)
euri10
@euri10
3 backticks
betaalpha
@betaalpha_gitlab

``` @app.get("/long_task", status_code=202) # 202=Accepted
async def long_task():
from backend.workers import tasks
mytask = tasks.long_task.apply_async(kwargs={'num':30})
return {'task_id': mytask.task_id}

@app.get("/long_task/status/{task_id}", status_code=200) # 200=OK
async def long_task_status(task_id: str):
from backend.workers import tasks
result = tasks.long_task.AsyncResult(task_id)
return {'status': result.status}
```

euri10
@euri10
code
betaalpha
@betaalpha_gitlab
code
euri10
@euri10
you can switch to compose mode icon on the right to do it easily
betaalpha
@betaalpha_gitlab
code
That black background thing is still not coming. I am in compose mode. Sending using Cntrl+Enter
William Hayes
@wshayes
Info on adding code samples and using compose mode
They don’t make it easy
You can also edit prior messages
betaalpha
@betaalpha_gitlab
I have to be in compose mode. Write the following: var code=<Copy/Paste my code>; and press Cntrl+Enter
Is it?

```var code="@app.get("/long_task", status_code=202) # 202=Accepted
async def long_task():
from backend.workers import tasks
mytask = tasks.long_task.apply_async(kwargs={'num':30})
return {'task_id': mytask.task_id}

@app.get("/long_task/status/{task_id}", status_code=200) # 200=OK
async def long_task_status(task_id: str):
from backend.workers import tasks
result = tasks.long_task.AsyncResult(task_id)
return {'status': result.status}";```

Damn. I am looking foolish...
euri10
@euri10
you miss return carriage after the backticks
William Hayes
@wshayes
backticks have to be on separate line
betaalpha
@betaalpha_gitlab
var code="@app.get("/long_task", status_code=202)  # 202=Accepted
async def long_task():
    from backend.workers import tasks
    mytask = tasks.long_task.apply_async(kwargs={'num':30})
    return {'task_id': mytask.task_id}

@app.get("/long_task/status/{task_id}", status_code=200)  # 200=OK
async def long_task_status(task_id: str):
    from backend.workers import tasks
    result = tasks.long_task.AsyncResult(task_id)
    return {'status': result.status}"
Wonderful. Thank for bearing with me.
Following goes into celery_common.py
var code="from celery import Celery

CELERY_TASK_LIST = [
    'worker.tasks',
]

def create_celery_app():
    celery_app = Celery('worker')
    celery_app.conf.update(
        result_backend = 'redis://localhost:6379/1',
        broker_url = 'redis://localhost:6379/0',
        broker_transport_options = {'confirm_publish': True},
        task_track_started = True,
        task_ignore_result = False,
        accept_content = ['json'],
        task_serializer = 'json',
        result_serializer = 'json',
        worker_send_task_events = True,
        timezone = 'Asia/Calcutta',
    )
    return celery_app

celery_app = create_celery_app()
And in my workers
var code="from backend.celery_common import celery_app"
Thats all where I am now.
William Hayes
@wshayes
Thanks for sharing - var code … maybe a little javascript mixed in?
euri10
@euri10
does anyone know if flower is supposed to monitor beat tasks from celery ?
William Hayes
@wshayes
Haven’t tried that yet. It works pretty well for regular tasks - haven’t tried it for scheduled tasks.
euri10
@euri10
well seems like flower dont get them
euri10
@euri10

well seems like flower dont get them

I stand corrected, was triggering taks on stagging area and looking flower in local dev :confused:

betaalpha
@betaalpha_gitlab
from backend.celery_common import celery_app
@wshayes Just a python file for celery workers. They needs a common instance of celery
I decorate my celery tasks with @celery_app ...
betaalpha
@betaalpha_gitlab
Just ignore the var code= thing. They were reminiscent of my incompetencies in posting code here at Gitter. Seems I can't edit those posts now.
betaalpha
@betaalpha_gitlab
Hi
Should I be using sqlalchemy ORM or ecode/database/sqlalchemy-core with fastapi?
What are the pro/cons of both approach. I have skimmed the docs and seems both are supported pretty well.
David Montague
@dmontagu
@euri10 what docker image did you use for flower
mher/flower
why ?
David Montague
@dmontagu
that's not the one tiangolo's project generator uses, I made a PR to use that one, but was curious if you were using the same as the project generator and had it working