milicp / ckanext-lire

CKAN extension for managing datasets relationships
7 stars 12 forks source link

Commit relation doesn't work #5

Open ted-strauss-K1 opened 7 years ago

ted-strauss-K1 commented 7 years ago

I have installed the extension and the interface loads fine and appears to work. But when I commit a relation, nothing happens. The ckan error log throws the errors pasted below.

The key section might be this one.

[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py', line 595 in package_relationship_create
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   raise NotFound('Subject package %r was not found.' % id)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] NotFound: Subject package u'Test Dataset 01' was not found.

Do datasets need to have certain properties in order to support relationships?

My CKAN version = 2.5.3

Full error log:

[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] Error - <class 'ckan.logic.NotFound'>: Subject package u'Test Dataset 01' was not found.
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] URL: http://my.ckan.org/lire/storeRelationships
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/weberror/errormiddleware.py', line 171 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   app_iter = self.application(environ, sr_checker)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   resp = self.call_func(req, *args, **self.kwargs)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return self.func(req, *args, **kwargs)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/fanstatic/publisher.py', line 234 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return request.get_response(self.app)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   application, catch_exc_info=False)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   app_iter = application(self.environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   resp = self.call_func(req, *args, **self.kwargs)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return self.func(req, *args, **kwargs)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/fanstatic/injector.py', line 54 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   response = request.get_response(self.app)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   application, catch_exc_info=False)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   app_iter = application(self.environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py', line 389 in inner
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   result = application(environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/beaker/middleware.py', line 73 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return self.app(environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/beaker/middleware.py', line 155 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return self.wrap_app(environ, session_start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/routes/middleware.py', line 131 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   response = self.app(environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/wsgiapp.py', line 125 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   response = self.dispatch(controller, environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/wsgiapp.py', line 324 in dispatch
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return controller(environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckan/lib/base.py', line 337 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   res = WSGIController.__call__(self, environ, start_response)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 221 in __call__
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   response = self._dispatch_call()
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 172 in _dispatch_call
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   response = self._inspect_call(func)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 107 in _inspect_call
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   result = self._perform_call(func, args)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 60 in _perform_call
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   return func(**args)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckanext/stats/public/ckanext/ckanext-lire/ckanext/lire/controllers/ace.py', line 27 in storeRelationships
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   data_dict={'subject': request.params['subject'],'object':request.params['object'],'type':request.params['type'],'comment':request.params['comment']})
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py', line 416 in wrapped
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   result = _action(context, data_dict, **kw)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] File '/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py', line 595 in package_relationship_create
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   raise NotFound('Subject package %r was not found.' % id)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] NotFound: Subject package u'Test Dataset 01' was not found.
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] 
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] 
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] CGI Variables
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] -------------
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   AUTH_TYPE: 'cookie'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   CKAN_CURRENT_URL: '/lire/storeRelationships'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   CKAN_LANG: 'en'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   CKAN_LANG_IS_DEFAULT: True
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   CONTENT_TYPE: 'application/x-www-form-urlencoded; charset=utf-8'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   DOCUMENT_ROOT: '/etc/apache2/htdocs'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   GATEWAY_INTERFACE: 'CGI/1.1'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_ACCEPT: '*/*'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_ACCEPT_ENCODING: 'gzip, deflate'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_ACCEPT_LANGUAGE: 'en-US,en;q=0.5'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_CONNECTION: 'close'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_COOKIE: 'auth_tkt="2884b863ab5eb49c268a755d40e8e268583dcda2admin!userid_type:unicode"; auth_tkt="2884b863ab5eb49c268a755d40e8e268583dcda2admin!userid_type:unicode"; _ga=GA1.2.1844000159.1480460661'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_HOST: 'my.ckan.org'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_REFERER: 'http://my.ckan.org/lire/manager'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   HTTP_X_REQUESTED_WITH: 'XMLHttpRequest'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   PATH_INFO: '/lire/storeRelationships'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   PATH_TRANSLATED: '/etc/ckan/default/apache.wsgi/lire/storeRelationships'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REMOTE_ADDR: '127.0.0.1'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REMOTE_PORT: '54463'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REMOTE_USER: u'admin'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REMOTE_USER_DATA: 'userid_type:unicode'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REMOTE_USER_TOKENS: ['']
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REQUEST_METHOD: 'POST'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   REQUEST_URI: '/lire/storeRelationships'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SCRIPT_FILENAME: '/etc/ckan/default/apache.wsgi'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_ADDR: '127.0.0.1'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_ADMIN: '[no address given]'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_NAME: 'my.ckan.org'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_PORT: '80'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_PROTOCOL: 'HTTP/1.0'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_SIGNATURE: '<address>Apache/2.2.22 (Ubuntu) Server at my.ckan.org Port 80</address>\\n'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   SERVER_SOFTWARE: 'Apache/2.2.22 (Ubuntu)'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] 
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] 
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] WSGI Variables
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] --------------
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   application: <fanstatic.publisher.Delegator object at 0x7f9c92dc8c90>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   beaker.cache: <beaker.cache.CacheManager object at 0x7f9c92dc8d10>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x7f9c92fb3b90>>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   beaker.session: {'_accessed_time': 1480529001.353718, '_creation_time': 1480529001.353718}
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   fanstatic.needed: <fanstatic.core.NeededResources object at 0x7f9c84e01590>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.application_group: 'my.ckan.org|'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.callable_object: 'application'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.handler_script: ''
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.input_chunked: '0'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.listener_host: ''
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.listener_port: '8080'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.process_group: 'ckan_default'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.request_handler: 'wsgi-script'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.script_reloading: '1'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   mod_wsgi.version: (3, 3)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   paste.cookies: (<SimpleCookie: _ga='GA1.2.1844000159.1480460661' auth_tkt='2884b863ab5eb49c268a755d40e8e268583dcda2admin!userid_type:unicode'>, 'auth_tkt="2884b863ab5eb49c268a755d40e8e268583dcda2admin!userid_type:unicode"; auth_tkt="2884b863ab5eb49c268a755d40e8e268583dcda2admin!userid_type:unicode"; _ga=GA1.2.1844000159.1480460661')
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   paste.registry: <paste.registry.Registry object at 0x7f9c6c20c810>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   paste.throw_errors: True
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   pylons.action_method: <bound method ACEController.storeRelationships of <ckanext.lire.controllers.ace.ACEController object at 0x7f9c84dd2210>>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   pylons.controller: <ckanext.lire.controllers.ace.ACEController object at 0x7f9c84dd2210>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   pylons.environ_config: {'session': 'beaker.session', 'cache': 'beaker.cache'}
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   pylons.pylons: <pylons.util.PylonsContext object at 0x7f9c84dd2110>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   pylons.routes_dict: {'action': u'storeRelationships', 'controller': u'ckanext.lire.controllers.ace:ACEController'}
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   repoze.who.api: <repoze.who.api.API object at 0x7f9c6c20c390>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   repoze.who.identity: <repoze.who identity (hidden, dict-like) at 140310467431424>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   repoze.who.logger: <logging.Logger object at 0x7f9c92dc89d0>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   repoze.who.plugins: {'ckan.lib.authenticator:UsernamePasswordAuthenticator': <ckan.lib.authenticator.UsernamePasswordAuthenticator object at 0x7f9c92dc8b50>, 'friendlyform': <FriendlyFormPlugin 140310455471888>, 'auth_tkt': <CkanAuthTktCookiePlugin 140310455471824>}
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   routes.route: <routes.route.Route object at 0x7f9c92e1cdd0>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   routes.url: <routes.util.URLGenerator object at 0x7f9c84e012d0>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   webob._parsed_post_vars: (MultiDict([('action', 'package_relationship_create'), ('subject', 'Test Dataset 01'), ('type', 'parent_of'), ('object', 'Test Dataset 02'), ('comment', 'created by user')]), <FakeCGIBody at 0x7f9c84e01bd0 viewing MultiDict([('ac...r')])>)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   webob._parsed_query_vars: (GET([]), '')
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   webob.adhoc_attrs: {'errors': 'ignore', 'response': <Response at 0x7f9c84e01610 200 OK>, 'language': 'en-us'}
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   webob.is_body_readable: True
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   webob.is_body_seekable: False
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   wsgi process: 'Multi process AND threads (?)'
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   wsgi.file_wrapper: <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7f9c84df7af8>
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   wsgi.version: (1, 1)
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1]   wsgiorg.routing_args: (<routes.util.URLGenerator object at 0x7f9c84e012d0>, {'action': u'storeRelationships', 'controller': u'ckanext.lire.controllers.ace:ACEController'})
[Wed Nov 30 13:03:21 2016] [error] [client 127.0.0.1] ------------------------------------------------------------
[Wed Nov 30 13:03:21 2016] [error] 2016-11-30 13:03:21,476 INFO  [ckan.lib.base]  /lire/storeRelationships render time 0.116 seconds
milicp commented 7 years ago

Datasets need to have certain metadata on which basis are created relationships between them. These metadata are

relationships: [ subject: "some subject dataset name..." object: "some object dataset name..." type: "relationship type..." comment: "some comment..." ]

metaodi commented 7 years ago

This could be related to https://github.com/ckan/ckan/issues/3188.

The last time I worked with the relationship API I noticed a strange behavior regarding the use of dataset ID vs. dataset names, maybe this is the issue here as well. Just a hint, I didn't look into this any further.

ted-strauss-K1 commented 7 years ago

Thanks. Just to follow up on @milicp's comment. I have created 2 datasets and setup the relationship using the lire interface, see picture. When I press the commit button, the number switches from 1 to 0, and the error log above is thrown. @milicp are you suggesting I use the API to commit the relation json array you show above?

image