This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tasks.py | |
import asyncio | |
import celery | |
app = celery.Celery('app') | |
async def coroutine(): | |
await asyncio.sleep(5) | |
print("pass 5 second") | |
@app.task | |
def simple_task(): | |
loop = asyncio.get_event_loop() | |
loop.run_until_complete(coroutine()) | |
// sample.py | |
from . import tasks | |
if __name__ == '__main__': | |
tasks.simple_task.apply_async() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment