update tree automatically
This commit is contained in:
parent
7725c65aeb
commit
b52585bbb9
2 changed files with 19 additions and 0 deletions
6
ontology/update.sh
Executable file
6
ontology/update.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh
|
||||||
|
cd `dirname $0`
|
||||||
|
./update_keywords.py
|
||||||
|
./update.py
|
||||||
|
./ontology.py
|
||||||
|
cp ontology.json ../../static/ontology/
|
13
tasks.py
13
tasks.py
|
@ -1,4 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from celery.task import periodic_task
|
from celery.task import periodic_task
|
||||||
|
|
||||||
@periodic_task(run_every=timedelta(hours=1), queue='encoding')
|
@periodic_task(run_every=timedelta(hours=1), queue='encoding')
|
||||||
|
@ -7,3 +10,13 @@ def subtitles_user(**kwargs):
|
||||||
from user.models import User
|
from user.models import User
|
||||||
u = User.object.get(username='subtitles')
|
u = User.object.get(username='subtitles')
|
||||||
annotation.models.Annotation.objects.filter(layer='subtitles').exclude(user=u).update(user=u)
|
annotation.models.Annotation.objects.filter(layer='subtitles').exclude(user=u).update(user=u)
|
||||||
|
|
||||||
|
|
||||||
|
t = datetime.now() - annotation.models.Annotation.objects.all().order_by('-created')[0].created
|
||||||
|
if t < timedelta(hours=1):
|
||||||
|
try:
|
||||||
|
subprocess.call(['/srv/pandora/pandora/cms/ontology/update.sh'])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue