示例#1
0
文件: tasks.py 项目: Niederb/kluster
def generate_tagjob(job_id):
    context = {}
    logging.debug('generate_tagjob: %s' % job_id)

    job = TagJob.objects.get(id=job_id)
    
    pca = Pca()
    pca.add_lines(job.get_taglines_list())
    filename = '%s.%s' % (uuid.uuid1(),job.format) 
    filepath = os.path.join(settings.MEDIA_ROOT, 'downloads',filename)
    
    try:     
        pca.render_file(filepath)
        job.outputfile = os.path.join('downloads',filename)
    except:
        logging.exception('could not render output')
    
    job.generated = datetime.datetime.now()
    job.save()
    
    context.update({
        'img': filename,
    })

    return context
示例#2
0
 def handle(self, *args, **options):
     pca = Pca()
     
     if len(args) < 2:
         raise CommandError('requires at least 2 arguments')
         
     for csv_file in args[:-1]:
         pca.load_csv(csv_file)
         
     pca.show()
     pca.render_file(args[-1])