[{"data":1,"prerenderedAt":250},["ShallowReactive",2],{"project-32799358":3},{"id":4,"name":5,"line":6,"line_source":7,"title":8,"url":9,"domain":10,"maker":11,"posted_at":12,"year":13,"points":14,"comments":15,"rank_in_year":16,"shown_in_year":17,"top":18,"tier":19,"category":20,"subcategory":21,"format":22,"keywords":23,"reception":29,"sentiment":30,"stance_mix":31,"scored_comments":36,"aspects":37,"strip":42,"post_text":44,"what":45,"said":78,"maker_in_thread":167,"shape":177,"grid":181,"attempts":211,"same_week":212,"maker_shows":36,"maker_hidden":242,"reader_version":243,"card":244},"32799358","Chard","simple async\u002Fawait background tasks for Django","title","Show HN: Chard – simple async\u002Fawait background tasks for Django","https:\u002F\u002Fgithub.com\u002Fdrpancake\u002Fchard","github.com","drpancake",1662902161,2022,61,16,868,2570,34,"notable","dev_tools","background task queue","library",[24,25,26,27,28],"django","background tasks","async await","task queue","celery alternative","debated",0.042,{"positive":32,"neutral":33,"mixed":34,"critical":35},4,0,1,3,8,{"idea":38,"design":39,"docs":41},{"positive":35,"critical":34},{"positive":33,"critical":40},2,{"positive":34,"critical":33},[33,43,33,34,33,43,33,43,33,43,33,34,33,35,34,33],5,null,{"problem":46,"audience":53,"pricing":44,"motivation":62,"time_to_build":44,"stack":66,"openness":75,"stage":76,"team_size":77},{"value":47,"source":48,"evidence":49},"Running background tasks in Django without Redis or RabbitMQ","maker",[50],{"id":51,"by":11,"text":52},"32799654","Hey everyone. The idea here is take advantage of the new async\u002Fawait ORM features in Django 4.1* to build a lightweight background task queue for Django that runs in a single…",{"value":54,"source":55,"evidence":56},"Django developers who want background tasks without external infrastructure","inferred",[57,58],{"id":51,"by":11,"text":52},{"id":59,"by":60,"text":61},"32802867","phoebefactorial","I've been very excited to see Django embrace asyncio, and your package looks like a great way to do async task queues. I've built a lot of very low traffic Django sites that are…",{"value":63,"source":48,"evidence":64},"Take advantage of new async ORM features in Django 4.1 to build a lightweight queue",[65],{"id":51,"by":11,"text":52},[67,71],{"value":68,"source":55,"evidence":69},"Python",[70],{"id":51,"by":11,"text":52},{"value":72,"source":48,"evidence":73},"Django 4.1 async ORM",[74],{"id":51,"by":11,"text":52},"open_source","prototype","unknown",{"praise":79,"objections":97,"requests":125,"questions":133,"alternatives":146},[80,93],{"value":81,"source":82,"evidence":83},"Simple, minimalist alternative for low-traffic Django sites without Redis","commenter",[84,85,89],{"id":59,"by":60,"text":61},{"id":86,"by":87,"text":88},"32800168","canadiantim","This looks awesome! I'll definitely check it out. Always on the lookout for minimalist django libraries. I'll give it a go in a couple weeks. Thanks for making it and sharing!",{"id":90,"by":91,"text":92},"32801454","adparadox","I love the simplicity of this idea because for lots of sites the database works just fine as a queue backend and it reduces the amount of infrastructure needed. I currently use…",{"value":94,"source":82,"evidence":95},"Async-first design suits future Django async features",[96],{"id":90,"by":91,"text":92},[98,105,115],{"value":99,"source":82,"evidence":100},"Database-backed task model is still a dependency",[101],{"id":102,"by":103,"text":104},"32800686","xoudini","> without any external dependencies (i.e. no Redis\u002FRabbitMQ) You still depend on a database with the `Task` model. This would be a no-go for that reason, since there's no…",{"value":106,"source":82,"evidence":107},"A separate worker process still needs monitoring and deployment plumbing",[108,112],{"id":109,"by":110,"text":111},"32800608","spapas82","My problem with this (and similar projects) is that there actually is a dependency: Running the worker! This may look like a small thing but in a production environment this…",{"id":113,"by":110,"text":114},"32801109","Great explanation thank you! My go-to stack is Django over gunicorn over nginx like you describe (industry standard setup in Python web development) and I wouldn't like to change…",{"value":116,"source":82,"evidence":117},"Tasks must be async, so synchronous code needs sync_to_async wrapping",[118,122],{"id":119,"by":120,"text":121},"32801865","etaioinshrdlu","It looks like it requires all the code in your task to use async code?",{"id":123,"by":11,"text":124},"32805696","That's right although you could take a synchronous function and wrap it with sync_to_async() and it would work. But I'm not sure about the performance implications of that.…",[126],{"value":127,"source":82,"evidence":128},"A roadmap section toward a stable 1.0 API",[129],{"id":130,"by":131,"text":132},"32800252","lmeyerov","Awesome, we were just discussing internally how to do such an architecture Maybe a \"where to help\" \u002F roadmap section for a sense of 'what is left for a stable & reasonably…",[134,142],{"value":135,"source":82,"evidence":136},"Can tasks run without a separate worker process?",[137,138],{"id":109,"by":110,"text":111},{"id":139,"by":140,"text":141},"32800930","nerdponx","It depends a lot on how the application is set up. > So, my ideal async task thingie would be to start an async worker on the fly when there are tasks; the worker will be killed…",{"value":143,"source":82,"evidence":144},"Does wrapping sync functions with sync_to_async perform well?",[145],{"id":123,"by":11,"text":124},[147,151,155,159,163],{"value":148,"source":82,"evidence":149},"django-db-queue",[150],{"id":90,"by":91,"text":92},{"value":152,"source":82,"evidence":153},"Django Q",[154],{"id":90,"by":91,"text":92},{"value":156,"source":82,"evidence":157},"django-rq",[158],{"id":90,"by":91,"text":92},{"value":160,"source":82,"evidence":161},"Celery",[162],{"id":139,"by":140,"text":141},{"value":164,"source":82,"evidence":165},"Dramatiq",[166],{"id":139,"by":140,"text":141},{"comments":168,"answered":40,"key":169},7,[170,171,174],{"id":51,"text":52},{"id":172,"text":173},"32805738","Do let me know how it goes :)",{"id":175,"text":176},"32805735","Sure but for 99.9% of Django projects you safely assume there is a database available. I'm not entirely sure why that's a no-go.",{"commenters":178,"max_depth":35,"maker_replies":168,"first_comment_mins":179,"lifespan_hours":180},9,38,14,[182,184,185,187,189,191,192,195,196,198,200,203,205,207,209,210],[51,33,33,183,11,34],"project\u002Fpositive\u002Fidea",[86,33,43,183,87,33],[172,33,33,186,11,34],"maker\u002Fneutral\u002Fnone",[102,33,34,188,103,33],"project\u002Fcritical\u002Fdesign",[175,33,33,190,11,34],"project\u002Fneutral\u002Fdesign",[90,33,43,183,91,33],[193,33,33,194,11,34],"32805782","project\u002Fneutral\u002Fperformance",[59,33,43,183,60,33],[197,33,33,183,11,34],"32805748",[130,34,43,199,131,33],"project\u002Fpositive\u002Fdocs",[201,34,33,202,11,34],"32805732","maker\u002Fpositive\u002Fdocs",[109,40,34,204,110,33],"project\u002Fcritical\u002Fidea",[139,40,33,206,140,33],"other\u002Fneutral\u002Fnone",[113,40,35,208,110,33],"project\u002Fmixed\u002Fidea",[119,35,34,188,120,33],[123,35,33,194,11,34],[],[213,218,223,228,233,237],{"id":214,"name":215,"points":216,"category":217},"32768590","Modern for HN",308,"productivity",{"id":219,"name":220,"points":221,"category":222},"32798891","HiFiScan",260,"creative",{"id":224,"name":225,"points":226,"category":227},"32828309","Infernal Sigil",238,"games",{"id":229,"name":230,"points":231,"category":232},"32837829","StackAid",226,"infrastructure",{"id":234,"name":235,"points":236,"category":20},"32828799","s3sqlite",160,{"id":238,"name":239,"points":240,"category":241},"32823589","pg_netstat",158,"data",false,"v2",{"id":245,"name":5,"line":6,"ai":242,"cat":20,"year":13,"points":14,"comments":15,"rec":29,"s":246,"top":18,"kw":247,"maker":11,"domain":10,"tier":19,"attempts":33,"strip":248,"url":9,"mix":249,"praise":81,"objection":99,"sub":21},32799358,0.04,[24,25,26,27,28],"0501050505010310",[32,33,34,35],1794036624798]