<commit_before>'''
--------------------------------------------------------------------------------------
tasks.py
--------------------------------------------------------------------------------------
A set of tasks to manage your AWS Django deployment.

author : <NAME> (github.com/ashokfernandez/)
credit : Derived from files in https://github.com/gcollazo/Fabulous
date   : 11 / 3 / 2014

Tasks include:
    - configure_instance  : Configures a new EC2 instance (as definied in project_conf.py) and return's it's public dns
                            This takes around 8 minutes to complete.

    - update_packages : Updates the python packages on the server to match those found in requirements/common.txt and
                        requirements/prod.txt

    - deploy : Pulls the latest commit from the master branch on the server, collects the static files, syncs the db and
                 restarts the server

    - reload_gunicorn : Pushes the gunicorn startup script to the servers and restarts the gunicorn process, use this if you
                        have made changes to templates/start_gunicorn.bash

    - reload_nginx : Pushes the nginx config files to the servers and restarts the nginx, use this if you
                     have made changes to templates/nginx-app-proxy or templates/nginx.conf

    - reload_supervisor : Pushes the supervisor config files to the servers and restarts the supervisor, use this if you
                            have made changes to templates/supervisord-init or templates/supervisord.conf

'''

# Spawns a new EC2 instance (as definied in djangofab_conf.py) and return's it's public dns
# This takes around 8 minutes to complete.
configure_instance = [

    # First command as regular user

    {"action": "run", "params": "whoami"},

    # sudo apt-get update
    {"action": "sudo", "params": "apt-get update -qq",
     "message": "Updating apt-get"},

    # List of APT packages to install
    {"action": "apt",
     "params": ["libpq-dev", "nginx", "memcached", "git",
                "python-setuptools", "python-dev", "build-essential", "python-pip"],
     "message":"Installing apt-get packages"},

    # List of pypi packages to install
    {"action": "pip", "params": ["virtualenv", "virtualenvwrapper", "supervisor"],
     "message":"Installing pip packages"},

    # Add AWS credentials to the a config file so that boto can access S3
    {"action": "put_template", "params": {"template": "%(FAB_CONFIG_PATH)s/templates/boto.cfg",
                                          "destination": "/home/%(SERVER_USERNAME)s/boto.cfg"}},
    {"action": "sudo",<commit_msg>update fabric provisioning task<commit_after>'''
--------------------------------------------------------------------------------------
tasks.py
--------------------------------------------------------------------------------------
A set of tasks to manage your AWS Django deployment.

author : <NAME> (github.com/ashokfernandez/)
credit : Derived from files in https://github.com/gcollazo/Fabulous
date   : 11 / 3 / 2014

Tasks include:
    - configure_instance  : Configures a new EC2 instance (as definied in project_conf.py) and return's it's public dns
                            This takes around 8 minutes to complete.

    - update_packages : Updates the python packages on the server to match those found in requirements/common.txt and
                        requirements/prod.txt

    - deploy : Pulls the latest commit from the master branch on the server, collects the static files, syncs the db and
                 restarts the server

    - reload_gunicorn : Pushes the gunicorn startup script to the servers and restarts the gunicorn process, use this if you
                        have made changes to templates/start_gunicorn.bash

    - reload_nginx : Pushes the nginx config files to the servers and restarts the nginx, use this if you
                     have made changes to templates/nginx-app-proxy or templates/nginx.conf

    - reload_supervisor : Pushes the supervisor config files to the servers and restarts the supervisor, use this if you
                            have made changes to templates/supervisord-init or templates/supervisord.conf

'''

# Spawns a new EC2 instance (as definied in djangofab_conf.py) and return's it's public dns
# This takes around 8 minutes to complete.
configure_instance = [

    # First command as regular user

    {"action": "run", "params": "whoami"},

    # sudo apt-get update
    {"action": "sudo", "params": "apt-get update -qq",
     "message": "Updating apt-get"},

    # List of APT packages to install
    {"action": "apt",
     "params": ["libpq-dev", "nginx", "memcached", "git",
                "python-setuptools", "python-dev", "build-essential", "python-pip", "python-lxml"],
     "message":"Installing apt-get packages"},

    # List of pypi packages to install
    {"action": "pip", "params": ["virtualenv", "virtualenvwrapper", "supervisor"],
     "message":"Installing pip packages"},

    # Add AWS credentials to the a config file so that boto can access S3
    {"action": "put_template", "params": {"template": "%(FAB_CONFIG_PATH)s/templates/boto.cfg",
                                          "destination": "/home/%(SERVER_USERNAME)s/boto.cfg"}},
    {"action": "sudo",
{'fraction_non_alphanumeric': 0.15744761185576742, 'fraction_numerical': 0.004530866528223523, 'mean_word_length': 2.218712029161604, 'pattern_counts': {'":': 32, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2921513', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1318, 'n_words': 523}