Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f0318ca7
authored
Mar 12, 2013
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
one: periodical update of statistics
parent
7958942b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
3 deletions
+23
-3
cloud/context_processors.py
+1
-2
cloud/settings.py
+8
-0
miscellaneous/devenv/nextinit.sh
+2
-1
one/jobs/quarter_hourly/__init__.py
+0
-0
one/jobs/quarter_hourly/stat_update.py
+12
-0
No files found.
cloud/context_processors.py
View file @
f0318ca7
...
@@ -7,8 +7,7 @@ def process_debug(req):
...
@@ -7,8 +7,7 @@ def process_debug(req):
return
{
'DEBUG'
:
DEBUG
}
return
{
'DEBUG'
:
DEBUG
}
def
process_stat
(
req
):
def
process_stat
(
req
):
# stat = cache.get('cloud_stat');
stat
=
cache
.
get
(
'cloud_stat'
)
stat
=
json
.
loads
(
subprocess
.
check_output
([
'/opt/webadmin/cloud/miscellaneous/stat/stat_wrap.sh'
]))
return
{
return
{
'STAT_DEBUG'
:
STAT_DEBUG
,
'STAT_DEBUG'
:
STAT_DEBUG
,
'cloud_stat'
:
stat
,
'cloud_stat'
:
stat
,
...
...
cloud/settings.py
View file @
f0318ca7
...
@@ -205,6 +205,14 @@ CELERY_ROUTES = {
...
@@ -205,6 +205,14 @@ CELERY_ROUTES = {
'one.tasks.SendMailTask'
:
{
'queue'
:
'local'
},
'one.tasks.SendMailTask'
:
{
'queue'
:
'local'
},
}
}
CACHES
=
{
'default'
:
{
'BACKEND'
:
'django.core.cache.backends.memcached.MemcachedCache'
,
'LOCATION'
:
'127.0.0.1:11211'
,
}
}
store_settings
=
{
store_settings
=
{
"basic_auth"
:
"True"
,
"basic_auth"
:
"True"
,
"verify_ssl"
:
"False"
,
"verify_ssl"
:
"False"
,
...
...
miscellaneous/devenv/nextinit.sh
View file @
f0318ca7
...
@@ -6,12 +6,13 @@ do
...
@@ -6,12 +6,13 @@ do
sudo
stop
$i
||
true
sudo
stop
$i
||
true
done
done
sudo
apt-get install rabbitmq-server gettext
sudo
apt-get install rabbitmq-server gettext
memcached
sudo
rabbitmqctl delete_user guest
||
true
sudo
rabbitmqctl delete_user guest
||
true
sudo
rabbitmqctl add_user nyuszi teszt
||
true
sudo
rabbitmqctl add_user nyuszi teszt
||
true
sudo
rabbitmqctl add_vhost django
||
true
sudo
rabbitmqctl add_vhost django
||
true
sudo
rabbitmqctl set_permissions
-p
django nyuszi
'.*'
'.*'
'.*'
||
true
sudo
rabbitmqctl set_permissions
-p
django nyuszi
'.*'
'.*'
'.*'
||
true
sudo
pip install python-memcached
sudo
cp /opt/webadmin/cloud/miscellaneous/devenv/boot_url.py /opt/
sudo
cp /opt/webadmin/cloud/miscellaneous/devenv/boot_url.py /opt/
...
...
one/jobs/quarter_hourly/__init__.py
0 → 100644
View file @
f0318ca7
one/jobs/quarter_hourly/stat_update.py
0 → 100644
View file @
f0318ca7
from
one.models
import
*
from
django_extensions.management.jobs
import
QuarterHourlyJob
from
django.core.cache
import
cache
import
json
class
Job
(
QuarterHourlyJob
):
help
=
"Update statistics from OpenNebula."
def
execute
(
self
):
stat
=
json
.
loads
(
subprocess
.
check_output
([
'/opt/webadmin/cloud/miscellaneous/stat/stat_wrap.sh'
]))
cache
.
set
(
'cloud_stat'
,
stat
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment