#!/usr/bin/env python
import os
import django
import logging_tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import unicode_literals | |
import logging | |
# built-in attributes on LogRecord. Used to determine what is passed in `extras` | |
RESERVED_ATTRS = ( | |
'args', 'asctime', 'created', 'exc_info', 'exc_text', 'filename', | |
'funcName', 'levelname', 'levelno', 'lineno', 'module', | |
'msecs', 'message', 'msg', 'name', 'pathname', 'process', | |
'processName', 'relativeCreated', 'stack_info', 'thread', 'threadName') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging.config | |
import os | |
from django.utils.log import DEFAULT_LOGGING | |
# Disable Django's logging setup | |
LOGGING_CONFIG = None | |
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper() | |
logging.config.dictConfig({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% set branch = pillar.name.split('.', 1)[0] %} | |
{{ branch }} db: | |
salt.function: | |
- name: state.apply | |
- tgt: salt.example.local | |
- arg: | |
- projects.test.dbs.generate_from_template | |
- kwarg: | |
pillar: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import os | |
# pip install boto3 psutil requests | |
import boto3 | |
import psutil | |
import requests | |
NAMESPACE = 'Sys' | |
os.environ.setdefault('AWS_DEFAULT_REGION', 'us-east-1') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
web: server.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# er/sites/site1.sls | |
SITE_ID: 14 | |
EMAIL: support@site1.com | |
LOG_FILE_DIR: /var/log/er_site1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python -m cProfile -s time ./manage.py makemigrations --empty pages | |
Migrations for 'pages': | |
0014_auto_20160107_1519.py: | |
66325365 function calls (65778093 primitive calls) in 157.981 seconds | |
Ordered by: internal time | |
ncalls tottime percall cumtime percall filename:lineno(function) | |
306135 10.721 0.000 16.741 0.000 __init__.py:139(__init__) | |
203638 8.801 0.000 14.381 0.000 __init__.py:370(deconstruct) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ manage.py showmigrations | grep "\[" | wc -l | |
85 | |
$ echo "\d" | psql mydb | grep -v sequence | wc -l | |
299 | |
$ time python -m cProfile -s time ./manage.py makemigrations --empty pages | |
Migrations for 'pages': | |
0014_auto_20160107_1356.py: | |
108764127 function calls (108404501 primitive calls) in 264.744 seconds | |
Ordered by: internal time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PYPYVENV="~/db-pypy" | |
CPYVENV="~/db-cpy" | |
virtualenv --python=`which pypy` $PYPYVENV | |
virtualenv $CPYVENV | |
$PYPYVENV/bin/pip install -e git://github.com/django/djangobench.git#egg=djangobench | |
$CPYVENV/bin/pip install -e git://github.com/django/djangobench.git#egg=djangobench |