ramses-tech / ramses-example

Example of a Pyramid app that uses ramses
The Unlicense
18 stars 6 forks source link

using postgresql as datastore, getting a duplicate User exception as follows #58

Closed Dowwie closed 8 years ago

Dowwie commented 8 years ago

pserve local.ini  07:52:13 2016-02-10 07:52:16,177 INFO [nefertari_sqla.signals][MainThread] signals.setup_es_signals_for: setup_sqla_es_signals_for: <class 'nefertari_sqla.documents.ESBaseDocument'> 2016-02-10 07:52:16,181 INFO [nefertari][MainThread] init.includeme: nefertari 0.6.1 2016-02-10 07:52:16,183 INFO [nefertari.json_httpexceptions][MainThread] json_httpexceptions.includeme: Include json_httpexceptions 2016-02-10 07:52:16,183 INFO [ramses][MainThread] init.includeme: Parsing RAML 2016-02-10 07:52:16,212 INFO [ramses][MainThread] init.includeme: Starting models generation 2016-02-10 07:52:16,212 INFO [ramses.generators][MainThread] generators.generate_models: Configuring model for route users 2016-02-10 07:52:16,215 DEBUG [ramses.models][MainThread] models.get_existing_model: Model User does not exist 2016-02-10 07:52:16,215 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,215 INFO [ramses.models][MainThread] models.setup_data_model: Generating model class User 2016-02-10 07:52:16,216 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Story does not exist 2016-02-10 07:52:16,218 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Story does not exist 2016-02-10 07:52:16,218 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,218 INFO [ramses.models][MainThread] models.setup_data_model: Generating model class Story 2016-02-10 07:52:16,219 INFO [nefertari_sqla.signals][MainThread] signals.setup_es_signals_for: setup_sqla_es_signals_for: <class 'ramses.models.Story'> 2016-02-10 07:52:16,230 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Profile does not exist 2016-02-10 07:52:16,231 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Profile does not exist 2016-02-10 07:52:16,231 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,231 INFO [ramses.models][MainThread] models.setup_data_model: Generating model class Profile 2016-02-10 07:52:16,231 INFO [nefertari_sqla.signals][MainThread] signals.setup_es_signals_for: setup_sqla_es_signals_for: <class 'ramses.models.Profile'> 2016-02-10 07:52:16,233 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Story already exists. Using existing one 2016-02-10 07:52:16,234 INFO [nefertari_sqla.signals][MainThread] signals.setup_es_signals_for: setup_sqla_es_signals_for: <class 'ramses.models.User'> 2016-02-10 07:52:16,239 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,239 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,239 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,239 INFO [ramses.generators][MainThread] generators.generate_models: Configuring model for route profile 2016-02-10 07:52:16,239 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Profile already exists. Using existing one 2016-02-10 07:52:16,239 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,239 INFO [ramses.generators][MainThread] generators.generate_models: Configuring model for route stories 2016-02-10 07:52:16,239 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Story already exists. Using existing one 2016-02-10 07:52:16,239 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,242 INFO [ramses.auth][MainThread] auth.setup_auth_policies: Configuring auth policies 2016-02-10 07:52:16,242 INFO [ramses.auth][MainThread] auth._setup_ticket_policy: Configuring Pyramid Ticket Authn policy 2016-02-10 07:52:16,281 INFO [nefertari.elasticsearch][MainThread] elasticsearch.setup: Including Elasticsearch. {'index.disable': 'false', 'enable_polymorphic_query': 'true', 'hosts': 'localhost:9200', 'index_name': 'ramses_example', 'sniff': 'false', 'chunk_size': 500, 'enable_refresh_query': 'true', 'enable_aggregations': 'true'} 2016-02-10 07:52:16,281 INFO [urllib3.connectionpool][MainThread] connectionpool._new_conn: Starting new HTTP connection (1): localhost 2016-02-10 07:52:16,284 INFO [elasticsearch][MainThread] base.log_request_success: HEAD http://localhost:9200/ramses_example [status:200 request:0.003s] 2016-02-10 07:52:16,298 INFO [ramses][MainThread] init.includeme: Starting server generation 2016-02-10 07:52:16,299 INFO [ramses.generators][MainThread] generators.generate_server: Server generation started 2016-02-10 07:52:16,299 INFO [ramses.generators][MainThread] generators.generate_resource: Configuring resource: users. Parent: root 2016-02-10 07:52:16,299 DEBUG [ramses.models][MainThread] models.get_existing_model: Model User already exists. Using existing one 2016-02-10 07:52:16,299 INFO [ramses.generators][MainThread] generators.generate_resource: Generating ACL for users 2016-02-10 07:52:16,299 DEBUG [ramses.acl][MainThread] acl.generate_acl: user_self_acl ACL scheme applied 2016-02-10 07:52:16,310 INFO [ramses.generators][MainThread] generators.generate_resource: Generating view for users 2016-02-10 07:52:16,310 INFO [ramses.generators][MainThread] generators.generate_resource: Creating new resource for users 2016-02-10 07:52:16,324 INFO [ramses.generators][MainThread] generators.generate_resource: Configuring resource: settings. Parent: user 2016-02-10 07:52:16,324 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,324 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,324 INFO [ramses.generators][MainThread] generators.generate_resource: Generating ACL for settings 2016-02-10 07:52:16,324 DEBUG [ramses.acl][MainThread] acl.generate_acl: No ACL scheme applied. Using ACL: [] 2016-02-10 07:52:16,324 INFO [ramses.generators][MainThread] generators.generate_resource: Generating view for settings 2016-02-10 07:52:16,324 INFO [ramses.generators][MainThread] generators.generate_resource: Creating new resource for settings 2016-02-10 07:52:16,339 INFO [ramses.generators][MainThread] generators.generate_resource: Configuring resource: groups. Parent: user 2016-02-10 07:52:16,339 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,339 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,339 INFO [ramses.generators][MainThread] generators.generate_resource: Generating ACL for groups 2016-02-10 07:52:16,339 DEBUG [ramses.acl][MainThread] acl.generate_acl: No ACL scheme applied. Using ACL: [] 2016-02-10 07:52:16,339 INFO [ramses.generators][MainThread] generators.generate_resource: Generating view for groups 2016-02-10 07:52:16,339 INFO [ramses.generators][MainThread] generators.generate_resource: Creating new resource for groups 2016-02-10 07:52:16,352 INFO [ramses.generators][MainThread] generators.generate_resource: Configuring resource: profile. Parent: user 2016-02-10 07:52:16,352 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,352 INFO [ramses.utils][MainThread] utils.resource_schema: Searching for model schema 2016-02-10 07:52:16,352 INFO [ramses.generators][MainThread] generators.generate_resource: Generating ACL for profile 2016-02-10 07:52:16,352 DEBUG [ramses.acl][MainThread] acl.generate_acl: user_profile_acl ACL scheme applied 2016-02-10 07:52:16,353 INFO [ramses.generators][MainThread] generators.generate_resource: Generating view for profile 2016-02-10 07:52:16,353 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Profile already exists. Using existing one 2016-02-10 07:52:16,353 INFO [ramses.generators][MainThread] generators.generate_resource: Creating new resource for profile 2016-02-10 07:52:16,366 INFO [ramses.generators][MainThread] generators.generate_resource: Configuring resource: stories. Parent: root 2016-02-10 07:52:16,366 DEBUG [ramses.models][MainThread] models.get_existing_model: Model Story already exists. Using existing one 2016-02-10 07:52:16,366 INFO [ramses.generators][MainThread] generators.generate_resource: Generating ACL for stories 2016-02-10 07:52:16,366 DEBUG [ramses.acl][MainThread] acl.generate_acl: item_owner_acl ACL scheme applied 2016-02-10 07:52:16,366 INFO [ramses.generators][MainThread] generators.generate_resource: Generating view for stories 2016-02-10 07:52:16,367 INFO [ramses.generators][MainThread] generators.generate_resource: Creating new resource for stories 2016-02-10 07:52:16,380 INFO [ramses][MainThread] init.includeme: Running nefertari.engine.setup_database 2016-02-10 07:52:16,465 INFO [nefertari.elasticsearch][MainThread] elasticsearch.setup_mappings: Setting up ES mappings for all existing models 2016-02-10 07:52:16,521 WARNI [elasticsearch][MainThread] base.log_request_fail: PUT /ramses_example/_mapping/User [status:400 request:0.055s] 2016-02-10 07:52:16,521 ERROR [nefertari.elasticsearch][MainThread] elasticsearch.perform_request: illegal_argument_exception 2016-02-10 07:52:16,523 ERROR [nefertari.json_httpexceptions][MainThread] json_httpexceptions.create_json_response: 400 BAD REQUEST: b'{"timestamp": "2016-02-10T12:52:16Z", "explanation": "b\'illegal_argument_exception\'", "status_code": 400, "extra": {"data": "TransportError(400, \'illegal_argument_exception\', \'Field [_version] is defined twice in [User]\')"}, "message": null, "title": "Bad Request"}' STACK BEGIN>> File "path_to_my_venvvenv34/bin/pserve", line 11, in sys.exit(main()) File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 58, in main return command.run() File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 328, in run global_conf=vars) File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp return loadapp(app_spec, name=name, relative_to=relative_to, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke _context.local_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(_args, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/urlmap.py", line 31, in urlmap_factory app = loader.get_app(app_name, global_conf=global_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 350, in get_app name=name, global_conf=global_conf).create() File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, _context.local_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(_args, _kw) File "path_to_my_venvramses-example/ramses_example/init.py", line 76, in main config.include('ramses') File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/config/init.py", line 755, in include c(configurator) File "path_to_my_venvvenv34/lib/python3.4/site-packages/ramses/init.py", line 66, in includeme ES.setup_mappings() File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 239, in setup_mappings es.put_mapping(body=model_cls.get_es_mapping()) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 255, in put_mapping _kwargs) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(_args, params=params, _kwargs) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/client/indices.py", line 291, in put_mapping '_mapping', doc_type), params=params, body=body) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/transport.py", line 329, in perform_request status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 60, in perform_request extra=dict(data=e)) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/json_httpexceptions.py", line 67, in exception_response return STATUS_MAPstatus_code File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/json_httpexceptions.py", line 78, in init create_json_response(self, *_kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/json_httpexceptions.py", line 58, in create_json_response msg += '\nSTACK BEGIN>>\n%s\nSTACK END<<' % add_stack() File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/json_httpexceptions.py", line 26, in add_stack return ''.join(traceback.format_stack())

STACK END<< Traceback (most recent call last): File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 49, in perform_request resp = super(ESHttpConnection, self).perform_request(_args, *_kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/connection/http_urllib3.py", line 106, in perform_request self._raise_error(response.status, raw_data) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/connection/base.py", line 105, in _raise_error raise HTTP_EXCEPTIONS.get(status_code, TransportError)(status_code, error_message, additional_info) elasticsearch.exceptions.RequestError: TransportError(400, 'illegal_argument_exception', 'Field [_version] is defined twice in [User]')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 239, in setup_mappings es.put_mapping(body=model_cls.get_es_mapping()) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 255, in put_mapping *_kwargs) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/client/utils.py", line 69, in _wrapped return func(_args, params=params, **kwargs) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/client/indices.py", line 291, in put_mapping '_mapping', doc_type), params=params, body=body) File "path_to_my_venvvenv34/lib/python3.4/site-packages/elasticsearch/transport.py", line 329, in perform_request status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout) File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 60, in perform_request extra=dict(data=e)) nefertari.json_httpexceptions.JHTTPBadRequest During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "path_to_my_venvvenv34/bin/pserve", line 11, in sys.exit(main()) File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 58, in main return command.run() File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 328, in run global_conf=vars) File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/scripts/pserve.py", line 363, in loadapp return loadapp(app_spec, name=name, relative_to=relative_to, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 144, in invoke _context.local_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(_args, _kw) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/urlmap.py", line 31, in urlmap_factory app = loader.get_app(app_name, global_conf=global_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 350, in get_app name=name, global_conf=global_conf).create() File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, _context.local_conf) File "path_to_my_venvvenv34/lib/python3.4/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(_args, _kw) File "path_to_my_venvramses-example/ramses_example/init.py", line 76, in main config.include('ramses') File "path_to_my_venvvenv34/lib/python3.4/site-packages/pyramid/config/init.py", line 755, in include c(configurator) File "path_to_my_venvvenv34/lib/python3.4/site-packages/ramses/init.py", line 66, in includeme ES.setup_mappings() File "path_to_my_venvvenv34/lib/python3.4/site-packages/nefertari/elasticsearch.py", line 241, in setup_mappings raise Exception(ex.json['extra']['data']) Exception: TransportError(400, 'illegal_argument_exception', 'Field [_version] is defined twice in [User]')

postatum commented 8 years ago

Hi @Dowwie. Are you using Elasticsearch 2.0.0+? If so downgrading to 1.7.5 should help. ES2 support for Ramses is not released yet.

Dowwie commented 8 years ago

​Thanks, Artem. That was the cause of the problem. ​

On Thu, Feb 11, 2016 at 2:59 AM, Artem Kostiuk notifications@github.com wrote:

Hi @Dowwie https://github.com/Dowwie. Are you using Elasticsearch 2.0.0+? If so downgrading to 1.7.5 should help. ES2 support for Ramses is not released yet.

— Reply to this email directly or view it on GitHub https://github.com/ramses-tech/ramses-example/issues/58#issuecomment-182755758 .

postatum commented 8 years ago

Good :)