Ejemplo n.º 1
0
    def get_void_desc(self, id):
        log.info('Generating VOID description for package: %s' % id)

        # using default functionality
        self.read(id, 'rdf')

        #check if metadada info exists and add it otherwise
        context = {'model': model, 'session': model.Session, 'user': c.user or c.author}
        package_info = get_action('package_show')(context, {'id': c.pkg.id})

        c.metadata_task_status = get_task_status_value(package_info['id'])

        c.extra_metadata = self.get_extra_metadata(c.pkg.id)

        #rendering using void template
        return render('package/void.rdf', loader_class=MarkupTemplate)
Ejemplo n.º 2
0
    def get_tasks_status(self, context):
        tasks_status = {}

        packages = get_action('package_list')(context, ())

        for package in packages:
            package_info = get_action('package_show')(context, {'id': package})

            try:
                task_status = get_action('task_status_show')(context, {'entity_id': package_info['id'], 'task_type': 'metadata', 'key': 'celery_task_status'})
                task_status_value = get_task_status_value(eval(task_status['value']))
                tasks_status[package_info['name']] = (task_status['id'], task_status_value)
            except NotFound:
                pass

        return tasks_status
Ejemplo n.º 3
0
    def show_metadata(self, id):
        log.info('Showing metadata for id: %s' % id)         

        # using default functionality
        template = self.read(id)

        #check if metadada info exists and add it otherwise
        context = {'model': model, 'session': model.Session, 'user': c.user or c.author}
        package_info = get_action('package_show')(context, {'id': c.pkg.id})

        c.metadata_task_status = get_task_status_value(package_info['id'])

        if 'launch' in request.params and c.user is not '':
            print 'Clearing metadata for package %s' % c.pkg.id
            model.Session.query(Property).filter_by(package_id=c.pkg.id).delete()
            model.Session.query(Timestamp).filter_by(package_id=c.pkg.id).delete()
            model.Session.commit()
            task_id = str(uuid.uuid4())
            celery.send_task("metadata.launch", args=[package_info['name']], task_id=task_id)

        c.extra_metadata = self.get_extra_metadata(c.pkg.id)

        #rendering using default template
        return render('metadata/read.html')