from celery.task.http import *
from flowspy.utils import beanstalkc
from django.conf import settings
+import datetime
import os
-cwd = os.getcwd()
-LOG_FILENAME = os.path.join(cwd, 'log/celery_jobs.log')
+
+LOG_FILENAME = os.path.join(settings.LOG_FILE_LOCATION, 'celery_jobs.log')
#FORMAT = '%(asctime)s %(levelname)s: %(message)s'
#logging.basicConfig(format=FORMAT)
route.status = status
route.response = response
route.save()
- subtask(announce).delay("[%s] Rule removal: %s%s- Result %s" %(route.applier, route.name, reason_text, response), route.applier)
+ subtask(announce).delay("[%s] Suspending rule : %s%s- Result %s" %(route.applier, route.name, reason_text, response), route.applier)
# May not work in the first place... proxy is not aware of Route models
@task
for route in routes:
route.status = status
route.response = response
+ route.expires = datetime.date.today()
route.save()
subtask(announce).delay("[%s] Rule removal: %s%s- Result %s" %(route.applier, route.name, reason_text, response), route.applier)
else:
if route.has_expired() and (route.status != 'EXPIRED' and route.status != 'ADMININACTIVE' and route.status != 'INACTIVE'):
logger.info('Expiring route %s' %route.name)
subtask(delete).delay(route, reason="EXPIRED")
- elif route.has_expired() and (route.status == 'ADMININACTIVE' or route.status == 'INACTIVE'):
- route.status = 'EXPIRED'
- route.response = 'Rule Expired'
- logger.info('Expiring route %s' %route.name)
- route.save()
+# elif route.has_expired() and (route.status == 'ADMININACTIVE' or route.status == 'INACTIVE'):
+# route.status = 'EXPIRED'
+# route.response = 'Rule Expired'
+# logger.info('Expiring route %s' %route.name)
+# route.save()
else:
if route.status != 'EXPIRED':
route.check_sync()