celery – Tasks that need to run in priority

Celery does not support task priority. (v3.0) http://docs.celeryproject.org/en/master/faq.html#does-celery-support-task-priorities You may solve this problem by routing tasks. http://docs.celeryproject.org/en/latest/userguide/routing.html Prepare default and priority_high Queue. from kombu import Queue CELERY_DEFAULT_QUEUE = ‘default’ CELERY_QUEUES = ( Queue(‘default’), Queue(‘priority_high’), ) Run two daemon. user@x:/$ celery worker -Q priority_high user@y:/$ celery worker -Q default,priority_high And route task. your_task.apply_async(args=[‘…’], queue=”priority_high”)

Is there a reliable python library for taking a BibTex entry and outputting it into specific formats?

There are the following projects: BibtexParser Pybtex Pybliographer BabyBib If you need complex parsing and output, Pybtex is recommended. Example: >>> from pybtex.database.input import bibtex >>> parser = bibtex.Parser() >>> bib_data = parser.parse_file(‘examples/foo.bib’) >>> bib_data.entries.keys() [u’ruckenstein-diffusion’, u’viktorov-metodoj’, u’test-inbook’, u’test-booklet’] >>> print bib_data.entries[‘ruckenstein-diffusion’].fields[‘title’] Predicting the Diffusion Coefficient in Supercritical Fluids Good luck.

What is the simplest and safest method to generate an API KEY and SECRET in Python

If you’re on Python 3.6 or later, the secrets module is the way to go: The secrets module is used for generating cryptographically strong random numbers suitable for managing data such as passwords, account authentication, security tokens, and related secrets. In particular, secrets should be used in preference to the default pseudo-random number generator in … Read more

How to detect that you’re in a test environment (check / determine if tests are being run)

Put this in your settings.py: import sys TESTING = len(sys.argv) > 1 and sys.argv[1] == ‘test’ This tests whether the second commandline argument (after ./manage.py) was test. Then you can access this variable from other modules, like so: from django.conf import settings if settings.TESTING: … There are good reasons to do this: suppose you’re accessing … Read more

Heroku postgres postgis – django releases fail with: relation “spatial_ref_sys” does not exist

Here is the workaround that I’ve come up with for our review apps that use a database backup, through pg:backups:restore ( might want to enable meaintenance if you’re manipulating a production database): Copy your review app database locally (one that was recently restored through pg:backups:restore so you get all the data): heroku pg:pull [Database URL] … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)