EMPMYMIP seems to mostly kind of work for me. It might even do the same for you!
The implementation is kind of a huge hack, though, and it might very well
with open('data.txt', 'r') as f: | |
for line in f.readlines(): | |
print line |
CELERY=`ps -A -o pid,rss,command | grep celeryd | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
GUNICORN=`ps -A -o pid,rss,command | grep gunicorn | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
REDIS=`ps -A -o pid,rss,command | grep redis | grep -v grep | awk '{total+=$2}END{printf("%d", total)}'` | |
NGINX=`ps -A -o pid,rss,command | grep nginx | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
OTHER=`ps -A -o pid,rss,command | grep -v nginx | grep -v celeryd | grep -v gunicorn | grep -v redis | grep -v grep | awk '{total+=$2}END{printf("%d", total/1024)}'` | |
websites=`ps -A -o user,pid,rss,command | grep gunicorn | egrep -o "[a-z_]+\.py$" | sort | uniq | perl -wpe 's|\.py$||;' | xargs` | |
printf "%-10s %3s MB\n" "Celery:" $CELERY | |
printf "%-10s %3s MB\n" "Gunicorn:" $GUNICORN | |
printf "%-10s %3s MB\n" "Nginx:" $NGINX | |
printf "%-10s %3s KB\n" "Redis:" $REDIS |
from django.conf import settings | |
from django.core.management.base import CommandError | |
from optparse import make_option | |
import re | |
import sys | |
try: | |
from south.management.commands.test import Command as BaseCommand | |
except ImportError: |
class UnableToGetLock(Exception): | |
pass | |
class Lock(object): | |
""" | |
Uses the defined cache backend to create a lock. | |
>>> with Lock('key name'): | |
>>> # do something |
#!/usr/bin/env python | |
""" | |
Run Django Tests with full test coverage | |
This starts coverage early enough to get all of the model loading & | |
other startup code. It also allows you to change the output location | |
from $PROJECT_ROOT/coverage by setting the $TEST_COVERAGE_OUTPUT_DIR | |
environmental variable. | |
""" |
def raw_update(self, *args, **kwargs): | |
"""Use the manager 'update' method for a given set of fields. | |
Values in args are the names of the model fields which should be updated db-side | |
Kwargs indicate new values for model fields that should be updated on the model *and* in the db. | |
The following are equivalent: | |
>>> self.raw_update('foo', bar='baz') | |
and | |
>>> self.bar = 'baz' |
$(document).bind('ajaxError', function(e, jqXHR){ | |
if (jqXHR.status == 500){ | |
var erframe = document.createElement('iframe'); | |
$('body').append(erframe); | |
$(erframe).css({ | |
'position': 'absolute', | |
'top': '5%', 'left': '50%', | |
'width': '90%', 'height': '90%', | |
'marginLeft': '-45%', | |
'z-index' : '9999999' |
import codecs | |
f = codecs.open('/tmp/myfile.csv', 'w', "utf-8") | |
# now use f as you would any file object |
from django.conf import settings | |
from django.core.management.base import CommandError | |
from optparse import make_option | |
import re | |
import sys | |
try: | |
from south.management.commands.test import Command as BaseCommand | |
except ImportError: |