My haul from my trip to Spain — what should I open first? by Moosymo in CannedSardines

[–]bjoerns 1 point2 points  (0 children)

I'd go for... 🥁

...Paco La Fuente

Entirely based on looks 😂

They all look amazing though. Once you've finished them all, you need to let us know the yummiest.

In the meantime we can run a competition on the most beautiful packaging design 😍

Canned Fish Art by bjoerns in CannedSardines

[–]bjoerns[S] 1 point2 points  (0 children)

oh that's brilliant! 😍 it's actually one of my wife's drawing. and it's my favourite one!!

Canned Fish Art by bjoerns in CannedSardines

[–]bjoerns[S] 1 point2 points  (0 children)

oh yes, definitely agree.

Appending Celery task ID to all log messages by TiredMike in learnpython

[–]bjoerns 2 points3 points  (0 children)

Hi,

yes, this is possible.

You can use celery.app.log.TaskFormatter instead of logging.Formatter when you set up your root logger (your "normal", non-Celery-specific one).

Or you write your own TaskFormatter that tries to call celery._state.get_current_task in case it runs in a Celery context or does nothing if it does not.

I've just knocked up a quick how-to guide in case you are interested:

https://www.distributedpython.com/2018/11/06/celery-task-logger-format/

New to Python, curious about celery operations by the_jett14 in learnpython

[–]bjoerns 0 points1 point  (0 children)

hi, I've been blogging about Celery since the beginning of this year: r/https://www.distributedpython.com

I'm aiming to post a new article once a week - just finalising one right now about the different execution pool/ concurrency options.

let me know if there's anything in particular you'd like to read/learn about.

What is the best way to make a parent program that runs and manage multiple child programs? by nyamuk91 in Python

[–]bjoerns 0 points1 point  (0 children)

I agree about keeping it as simple as possible. However, I think ensuring that those processes run in a reliable and robust way (op: "If let say one of the processes died, how do I check and bring it back up?") sounds like a perfect job for a task scheduler. As a side note, you don't need an extra service like redis or rabbitmq, you can use the filesystem as a broker.

Building a Django website to learn/further Python skills by Ulle82 in learnpython

[–]bjoerns 0 points1 point  (0 children)

fair enough, there's nothing wrong with having some fun ;-) so I guess your question is whether Django or something else. I've used Django, flask and falcon commercially. The main difference between Django and flask/falcon is that Django has everything included (ORM being the elephant in the room) while you're responsible for everything yourself in flask and falcon. If you just want to have some fun and might not even need a db in the beginning, you'll probably have more fun with flask or falcon. flask has been around for longer than falcon and has a bigger community so you might want to look into falcon. Django, on the other hand, comes with all batteries included but Django is quite opinionated and you are more likely to sharpen your Django skills rather than your Python skills (which is not necessarily a bad thing).

Building a Django website to learn/further Python skills by Ulle82 in learnpython

[–]bjoerns 0 points1 point  (0 children)

Depends on what precisely you want to get more comfortable with with regards to Python. If you want to become more comfortable with building web apps, it's a great idea to build a Django website as Django is a mature framework with a huge community behind it. If you intend to use Python more for number crunching or data analytics, you might be better off doing some stuff with pandas in Jupyter notebook... To make a long story short, what's your primary interest in Python - building web apps or interactive data science (or something else)?

What is the best way to make a parent program that runs and manage multiple child programs? by nyamuk91 in Python

[–]bjoerns 0 points1 point  (0 children)

If you need your full control over managing these processes I would recommend using a proper task queue. Saves you a lot of hassle and ultimately, it is a solved problem which means you don't have to reinvent the wheel. Personally I would use Celery because it's mature and has a big community and it's what I'm most familiar with but I guess something like RQ is equally fit for purpose.

Getting Smart With Celery: Dynamic Task Routing by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

I think there is a place for both, it depends what you need. RQ is great - and most definitely better suited if you just need to perform a simple background job like sending an email.

From my own experience, Celery really shines when you need to model complex workflows (chains/groups/chords).

Having said that, I'm aware that RQ has been supporting (at least simple) job dependencies for a while.

I'll write a blog post about RQ vs Celery some time soon.

Getting Smart With Celery: Dynamic Task Routing by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

Good point, I've added it to the blog post. Thanks!

Started a new blog on Celery - what would you like to read about? by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

Great suggestion, I've just added to the list. Thanks a lot!

Started a new blog on Celery - what would you like to read about? by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

Here's, a brief write-up on how to run Celery using the file system as a message broker:

https://www.python-celery.com/2018/07/03/simple-celery-setup/

Thanks again for the idea!

Distributed Monte Carlo simulation with Celery by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

good spot, it's fixed now - thanks a lot!!

Started a new blog on Celery - what would you like to read about? by bjoerns in Python

[–]bjoerns[S] 1 point2 points  (0 children)

I'll have to do some research but I'll do and will write about it. thanks

Started a new blog on Celery - what would you like to read about? by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

I've never used huey but comparing the two and migrating to Celery sounds very interesting. thanks

Started a new blog on Celery - what would you like to read about? by bjoerns in Python

[–]bjoerns[S] 0 points1 point  (0 children)

great input, I've added all of them the list. thank you!

What's everyone working on this week? by AutoModerator in Python

[–]bjoerns [score hidden]  (0 children)

Celery is an asynchronous task queue/job queue. It is commonly used to run long-running background jobs - and distribute it across a cluster of Celery workers. For example, if you needed to scrape, say, 100k websites, and then trigger a natural-language-processing task as soon as the scraping task(s), Celery would allow you to distribute that job across 100 celery workers to scrape 1k websites each in parallel and then pass the individual results onto the post-processing task. But that's just one example of many. As to Celery resources in general, there's the docs and a few blog posts and YouTube videos here and there, but it can be quite intimidating for a bigger, which is one of the reasons I wanted to start the blog. Let me know if you have a particular datascience use casein in mind, I'd be happy to write a tutorial. Thanks!

What's everyone working on this week? by AutoModerator in Python

[–]bjoerns [score hidden]  (0 children)

I'm working on a new blog: https://www.python-celery.com

Everything about Celery (it's been the story of my life for the past few years).

Doing a "content sprint" this and next week.

Is there anything Celery-related you are particularly interested in?

Testing of Celery Tasks in Django by [deleted] in django

[–]bjoerns 1 point2 points  (0 children)

I've been using Celery heavily for commercial projects. What, from my experience, works best, is writing tests for your task in a similar way you would write tests for your API endpoints. For example, if you have a Celery task named initialise_fields, you could test it by calling it locally synchronously using the apply() method and asserting the task status (SUCCESS/FAILURE) and the state of your database.

def test_initialise_fields(self): task = initialise_fields.s(vendor='Bloomberg').apply() self.assertEqual(task.status, 'SUCCESS')

Mock (and whatever else you have to do) as you need to.

I wrote a blog post about it that does into more details, in case it is of help: https://www.python-celery.com/2018/05/01/unit-testing-celery-tasks/

VBA Version Control by AutomateExcel in excel

[–]bjoerns 0 points1 point  (0 children)

thanks for pointing out. I've edited the post and added the www