tasks.py
516 Bytes
from __future__ import absolute_import
from celery.task import Task
from pyrosapp.models import Log
import time
import os
import observation_manager
class analysis(Task):
def run(self, image_name):
print("analysis : ", image_name)
time.sleep(1)
with open(os.path.join(observation_manager.tasks.IMAGES_FOLDER, str(image_name) + '_analyzed'), 'w'):
pass
message = 'Analyzed image in ' + str(image_name)
Log.objects.create(agent='Analyzer', message=message)