Celery flower for several applications

| Comments

If there is a need to monitor several applications, there are two ways:

  • run celery flower instance for each application
celery flower --app app1.celeryapp --port=5555
celery flower --app app2.celeryapp --port=5556
  • run celery flower with broker option, there will be less options to control tasks
celery flower --broker=redis://redis/0

Celery checklist

| Comments

There is a good checklist to build great celery async tasks.

I want only to add how to autoreload celery worker in development mode. Before there was an --autoreload option, but now it’s removed. For this task I use watchdog.

pip install watchdog
watchmedo auto-restart --recursive -d app -p '*.py' -i '*.pyc' -- celery worker --app app.celeryapp --queues my_query -n my_queue@%h --loglevel INFO

How to log user ip in Docker Swarm

| Comments

There is a long standing issue for this task. The logs looks like: - - [15/Mar/2018:15:32:15 +0000] “GET / HTTP/2.0” 200

One of the solutions, from the issue’s comments, is to run a service in the host mode, the swarm load balancing for this service will not work. But if there is a load balancer behind the swarm cluster, it seems not a big problem.

Export and import for MongoEngine model in Flask-Admin

| Comments

Another tip for Flask-Admin. The task’s requirements are:

  • possibility to choose some model’s objects and download them in JSON
  • possibility to upload them back

There is a ModelView property can_export, it adds an action to export in CSV or another format supported by tablib, but it does not allow to select records and there is no import. So for my task it’s not a solution.

The export is easy to do with an action decorathor.

An update for the productivity apps list

| Comments
An update for the productivity apps list

Several productivity apps I added to this list in the last month.

  • HazeOver - automatically highlights the front window by fading out all the background windows.
  • Hazel - watches whatever folders you tell it to, automatically organizing your files according to the rules you create.
  • Bartender - lets you organize your menu bar apps.
  • iStatMenus - adds system monitor to your menu bar.

For iTerm2 I failed to setup Automatic Profile Switching, but I found a good solution here - Change terminal color when SSH from OS-X.

Google Adsense and blog on subdomain

| Comments

This month I decided to try Google Adsense, just as an experiment. I expect no more 1-2$ in the next month. The process of adding adsense is easy, but the problem is that it requires a primary domain and on the primary domain sneawo.com I had a redirect to blog.sneawo.com. So the first attempt failed after 2 days of waiting. For a second attempt I put an html with a short text on the primary domain. This time it also took 2 days and was successfull.

Meanwhile, I looked some articles and almost all of them recommend to launch the blog in a subfolder, i.e. sneawo.com/blog. Maybe I’ll do it as next experiment.

« 2/8 »