Repository navigation
Description
What do you see as an issue?
This section is for specifying options which can be passed to the underlying celery broker transport. See: http://docs.celeryproject.org/en/latest/userguide/configuration.html#std:setting-broker_transport_options
So I want to use sqs (fifo) for my celery queue , I can't determine how to fill out this section.
Tried this:
[celery_broker_transport_options]
predefined_queues = { "default": { "region": "us-east-1", "url": "https://sqs.us-east-1.amazonaws.com/xxxx/asg-airflow-dev-queue.fifo", "MessageGroupId": "1", "MessageDeduplicationId": "123" }}
The https://docs.celeryq.dev/en/latest/getting-started/backends-and-brokers/sqs.html document shows this:
broker_transport_options = {
'predefined_queues': {
'my-q': {
'url': 'https://ap-southeast-2.queue.amazonaws.com/123456/my-q',
'access_key_id': 'xxx',
'secret_access_key': 'xxx',
'backoff_policy': {1: 10, 2: 20, 3: 40, 4: 80, 5: 320, 6: 640},
'backoff_tasks': ['svc.tasks.tasks.task1']
}
},
'sts_role_arn': 'arn:aws:iam:::role/STSTest', # optional
'sts_token_timeout': 900 # optional,
message_properties = {
'MessageGroupId': '',
'MessageDeduplicationId': ''
}
}
The closest think I can find is in this but it uses AIRFLOW__CELERY__CELERY_CONFIG_OPTIONS which is also not explained.
#20947
Solving the problem
add necessary example
Anything else
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
boring-cyborg commentedon Apr 8, 2022
Thanks for opening your first issue here! Be sure to follow the issue template!
tsugumi-sys commentedon May 20, 2022
@don1uppa
In my case, I need to re-install
pycurland set environment variables like below.When I try to use SQS, a worker instance caused errors like
ImportError: The curl client requires the pycurl library.Next, I try to re-install pycurl and
Permission deniederror caused (curl-config), so I runpip install pycurlas root and airflow seems to be working in my laptop.I also feel it is so haed to understand how to use SQS in airflow from the documents. I am not sure why this settings works for now but this might help?
Dockerfile
.env
docker-compose.yml
potiuk commentedon May 22, 2022
Can either of you make a PR to documentation with those instructions if you get them working please? @don1uppa and @tsugumi-sys ? This is an easy way to become one of the more than 2000 contributors to Airflow (and basically this is how the documentation is often added - by the users who can not only test it, but also describe it in the way that will be easy for other users to digest. Can I assign one of you to it ?
tsugumi-sys commentedon May 22, 2022
@potiuk
I’ll do this :) please assign me
potiuk commentedon May 22, 2022
Fantastic! Assigned you!
don1uppa commentedon May 22, 2022
brettpalmberg commentedon Jun 3, 2022
Hello @tsugumi-sys, @don1uppa. I am seeing the same error as @tsugumi-sys related to
pycurlwithairflow:2.3.1and SQS as a message broker. Is thepycurl,Permission denied: 'curl-config'error captured in another Issue? (I looked but did not see one).PR #24019 provides documentation, but I think there is still an underlying issue with
pycurlto support sqs near "out of the box" inapache/airflowDocker images. Here is a trace I see when using imageapache/airflow:2.3.1-python3.8(or-python3.9, I tried both to be sure).I tried a few alternatives to fix:
_PIP_ADDITIONAL_REQUIREMENTS="celery[sqs]". This fails because pip installs as userairflowand install of dependencypycurlrequires root permissions to runcurl-config, which is part of the pip install.USER rootbefore the pip install also seemed problematic.I would be happy to help, but do not know if/where a fix should be applied. Thank you.
brettpalmberg commentedon Jun 6, 2022
Was able to resolve this by switching to the new recommended method for building customized images post Airflow 2.3.0 using BuildKit (https://airflow.apache.org/docs/docker-stack/build.html#customizing-the-image). Specifically by providing the following
--build-argto the docker build command:potiuk commentedon Jun 6, 2022
Yeah that 's also part of the docs (the SQS part). We should not add SQS into the image. However it might be a good idea to add liubrcurl*openssl /libssl - so you can add them to a Dockerfile (both Dockerfile and Dockerfile.ci I think would make sense.
tsugumi-sys commentedon Jul 3, 2022
@brettpalmberg
Is this work if you don't use
--build-arg ADDITIONAL_PYTHON_DEPS="celery[sqs]"? And installinglibcurl4-openssl-dev libssl-devthrows still the same errorImportError: The curl client requires the pycurl library..potiuk commentedon Sep 20, 2022
This one should be closed as in #24019 we discussed that SQS is not going to be supported unless we made a conscious effort and testing to make it works.
don1uppa commentedon Sep 20, 2022
potiuk commentedon Sep 20, 2022
Let me correct this statement
It works for You and in Your case and in the very exact version of Airlfow, Celery, Kombu that You have installed and in the limited set of cases that Your installation covers. It might or might not work if any of those change. We have no tests to verify that.
By choosing SQS you take ("with great powers come great responsibilities") responsibilty on your shoulders that you will have to fix any problems that can arise with using SQS - on your own. For example, because we do not have tests, when we release a new version of Airflow we might make it stop working. Or when Amazon makes changes in how SQS works.
It's quite a huge risks you are taking, because when it will stop workiong, this is not a bug that you can raise and hope that community will fix it. Until we have tests and can easily reproduce and plug-in and automate tests for SQS, any problem with it is your problem and you will have to deal with it.
You can see an example problem #26521 and if you have any similar problem, it will not be considered a bug, but at most an interesting discussion to have, and you will have to fix it on your own/
don1uppa commentedon Sep 20, 2022