Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/xticks rotate #95

Merged
merged 3 commits into from
Oct 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/main/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,14 @@ def _axisfigure(self):
for sample in data:
x.append(sample.datetime)
y.append(sample.value)
ax.plot(x, y, '-')
ax.plot_date(x, y, '-')
self._setaxislimits(ax, min(y), max(y))
if self.sensor.name:
ax.set_title('{0} - {1}'.format(self.sensor.gage.name, self.sensor.name))
else:
ax.set_title('{0} - {1}'.format(self.sensor.gage.name, self.sensor.stype.capitalize()))
for item in ax.get_xticklabels():
item.set_rotation(30)
return ax, fig

def matplot(self):
Expand Down
24 changes: 16 additions & 8 deletions fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def create_database():
else:
print('{DB} not found! Creating DB'.format(DB=DB))
# require.postgres.user(DB_USER, password=DB_PASSWORD)
sudo('''psql -c "CREATE USER '{DB_USER}' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN UNENCRYPTED PASSWORD '{DB_PASSWORD}';"'''.format(DB_USER=DB_USER, DB_PASSWORD=DB_PASSWORD),
sudo("""psql -c "CREATE USER '{DB_USER}' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN UNENCRYPTED PASSWORD '{DB_PASSWORD}';""".format(DB_USER=DB_USER, DB_PASSWORD=DB_PASSWORD),
user='postgres')
# require.postgres.database(DB, owner=DB_USER)
sudo('createdb --owner {DB_USER} {DB}'.format(DB_USER=DB_USER, DB=DB),
Expand All @@ -128,25 +128,25 @@ def configure_git():
"""
require.directory(GIT_DIR, use_sudo=True)
with cd(GIT_DIR):
sudo('mkdir gage-web.git')
#sudo('mkdir gage-web.git')
with cd('gage-web.git'):
sudo('git init --bare')
#sudo('git init --bare')
with lcd(LOCAL_CONFIG_DIR):
with cd('hooks'):
put('./post-receive', './', use_sudo=True)
sudo('chmod +x post-receive')
with lcd(LOCAL_APP_DIR):
local(
'git remote add production {user}@{server}:{GIT_DIR}/gage-web.git'
.format(user=env.user, server=env.host_string, GIT_DIR=GIT_DIR))
#with lcd(LOCAL_APP_DIR):
# local(
# 'git remote add production {user}@{server}:{GIT_DIR}/gage-web.git'
# .format(user=env.user, server=env.host_string, GIT_DIR=GIT_DIR))


def deploy():
"""
Push current master to production and restart gunicorn
"""
with lcd(LOCAL_APP_DIR):
local('git push production master')
local('git push production')
sudo('supervisorctl restart gage:*')


Expand Down Expand Up @@ -265,6 +265,14 @@ def setup_celery():
sudo('supervisorctl restart gage:*')


def gage_restart():
"""
Cron script to restart the supervisorctl gage:gage-celery-beat hourly
"""
fabtools.cron.add_task('restart-gage-beat', '@hourly', 'root', WWW_DIR+'/server-config/restart-gage.sh')



def bootstrap():
"""
Setup all the things
Expand Down
6 changes: 5 additions & 1 deletion server-config/post-receive
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#!/bin/sh
GIT_WORK_TREE=/home/www/gage-web git checkout -f
while read oldrev newrev ref
do
echo "$ref recieved, probably deploying master"
GIT_WORK_TREE=/home/www/gage-web git checkout -f $ref
done
3 changes: 3 additions & 0 deletions server-config/restart-gage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

supervisorctl restart gage:gage-celery-beat