[PDB Tech] Peeringdb sync problem

Jan.Boogman at swisscom.com Jan.Boogman at swisscom.com
Fri May 22 11:35:06 PDT 2020


Hi Milton

I now went back from Django3.0.6 to Django2.2.12 and that did the trick!

Thanks a lot for your help

Best regards
Jan
________________________________
Von: Milton Ngan <milton at valvesoftware.com>
Gesendet: Freitag, 22. Mai 2020 18:01
An: Boogman Jan, INI-ONE-WSN-EIS-SNS <Jan.Boogman at swisscom.com>
Cc: stefan at 20c.com <stefan at 20c.com>; pdb-tech at lists.peeringdb.com <pdb-tech at lists.peeringdb.com>
Betreff: Re: [PDB Tech] Peeringdb sync problem

i think this one is caused by using Dango3. you should install Django < 3

Sent from my iPad

On May 22, 2020, at 8:19 AM, "Jan.Boogman at swisscom.com" <Jan.Boogman at swisscom.com> wrote:


Hi Stefan

I upgraded now to python3 and have new errors, I tried with python3.6.9 and 3.8.3:

pdb at pdb2:~$ peeringdb sync
Syncing to https://www.peeringdb.com/api
Updating resources: org fac net ix ixfac ixlan ixpfx netfac netixlan poc
Fetching & updating all: org
Updates to be processed: 4
Traceback (most recent call last):
  File "/usr/local/bin/peeringdb", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/cli.py", line 62, in main
    return handler(config=cfg, **vars(options))
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/commands.py", line 20, in _wrapped
    r = func(*a, **k)
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/commands.py", line 219, in handle
    client.update_all(rs)
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_update.py", line 66, in update_all
    self._atomic_update(lambda: ctx.sync_resource(r, since=since))
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_update.py", line 78, in _atomic_update
    sync_func()
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_update.py", line 66, in <lambda>
    self._atomic_update(lambda: ctx.sync_resource(r, since=since))
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_tasks_async.py", line 65, in _wrapped
    return loop.run_until_complete(func(*a, **k))
  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_tasks_async.py", line 41, in _wrapped
    item = gen.send(r)
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_update.py", line 187, in sync_row
    obj, fetched, dangling = _sync.initialize_object(B, res, row)
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/_sync.py", line 47, in initialize_object
    obj = B.get_object(B.get_concrete(res), row['id'])
  File "/usr/local/lib/python3.6/dist-packages/peeringdb/backend.py", line 26, in wrapped
    return fn(*args, **kwargs)
  File "/home/pdb/.local/lib/python3.6/site-packages/django_peeringdb/client_adaptor/backend.py", line 97, in get_object
    return concrete.objects.get(pk=id)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 411, in get
    num = len(clone)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 258, in __len__
    self._fetch_all()
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 1261, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 57, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1149, in execute_sql
    cursor = self.connection.cursor()
  File "/usr/local/lib/python3.6/dist-packages/django/utils/asyncio.py", line 24, in inner
    raise SynchronousOnlyOperation(message)
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
pdb at pdb2:~$

Cheers
Jan
________________________________
Von: Stefan Pratter <stefan at 20c.com>
Gesendet: Freitag, 22. Mai 2020 15:37
An: Boogman Jan, INI-ONE-WSN-EIS-SNS <Jan.Boogman at swisscom.com>; pdb-tech at lists.peeringdb.com <pdb-tech at lists.peeringdb.com>
Betreff: Re: AW: [PDB Tech] Peeringdb sync problem

Python2.7 support was dropped with version 2.0

I believe officially supported versions are now 3.5, 3.6, 3.7 and 3.8

Is upgrading to python3 a possibility on your end?

Stefan


On 22/05/2020 16.32, Jan.Boogman at swisscom.com wrote:
> Hi Stefan
>
> I had 1.1.0 after upgrading I get this error:
>
>
> pdb at pdb2:~$ pip freeze | grep django-peeringdb
> django-peeringdb==2.0.0
> pdb at pdb2:~$ peeringdb sync
> Traceback (most recent call last):
>    File "/usr/local/bin/peeringdb", line 11, in <module>
>      sys.exit(main())
>    File "/home/pdb/.local/lib/python2.7/site-packages/peeringdb/cli.py",
> line 62, in main
>      return handler(config=cfg, **vars(options))
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/peeringdb/commands.py",
> line 20, in _wrapped
>      r = func(*a, **k)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/peeringdb/commands.py",
> line 212, in handle
>      client = Client(config, **kwargs)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/peeringdb/client.py", line
> 44, in __init__
>      peeringdb.initialize_backend(orm_name, **orm_config)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/peeringdb/__init__.py",
> line 84, in initialize_backend
>      B = supportmod.load_backend(**kwargs)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django_peeringdb/client_adaptor/load.py",
> line 38, in load_backend
>      configure(**settings)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django_peeringdb/client_adaptor/setup.py",
> line 26, in configure
>      setup()
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django/__init__.py", line
> 27, in setup
>      apps.populate(settings.INSTALLED_APPS)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django/apps/registry.py",
> line 108, in populate
>      app_config.import_models()
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django/apps/config.py",
> line 202, in import_models
>      self.models_module = import_module(models_module_name)
>    File "/usr/lib/python2.7/importlib/__init__.py", line 37, in
> import_module
>      __import__(name)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django_peeringdb/models/__init__.py",
> line 4, in <module>
>      from django_peeringdb.models.abstract import * # noqa
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django_peeringdb/models/abstract.py",
> line 36, in <module>
>      class AddressModel(models.Model):
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django/db/models/base.py",
> line 162, in __new__
>      new_class.add_to_class(obj_name, obj)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django/db/models/base.py",
> line 325, in add_to_class
>      value.contribute_to_class(cls, name)
>    File
> "/home/pdb/.local/lib/python2.7/site-packages/django_countries/fields.py",
> line 300, in contribute_to_class
>      super().contribute_to_class(cls, name)
> TypeError: Error when calling the metaclass bases
>      super() takes at least 1 argument (0 given)
> pdb at pdb2:~$
>
> Best regards
> Jan
> ------------------------------------------------------------------------
> *Von:* Pdb-tech <pdb-tech-bounces at lists.peeringdb.com> im Auftrag von
> Stefan Pratter <stefan at 20c.com>
> *Gesendet:* Freitag, 22. Mai 2020 15:18
> *An:* pdb-tech at lists.peeringdb.com <pdb-tech at lists.peeringdb.com>
> *Betreff:* Re: [PDB Tech] Peeringdb sync problem
> Validation errors are often (not always) caused by the server's
> django-peeringdb version being ahead of your locally installed version.
> In other words the server treats something as valid, while the client
> doesn't.
>
> What's the output of
>
> `pip freeze | grep django-peeringdb`
>
> and if its < 2.0
>
> can you try updating to 2.0
>
> `pip install django-peeringdb==2.0`
>
> thanks,
> Stefan
>
> On 22/05/2020 13.18, Jan.Boogman at swisscom.com wrote:
>> Hi Arnold,
>>
>> indeed, seems to be the same issue
>>
>> Cheers
>> Jan
>>
>>
>> ------------------------------------------------------------------------
>> *Von:* Arnold Nipper
>> *Gesendet:* Freitag, 22. Mai 2020 12:09
>> *Bis:* Boogman Jan, INI-ONE-WSN-EIS-SNS; pdb-tech at lists.peeringdb.com
>> *Betreff:* Re: [PDB Tech] Peeringdb sync problem
>>
>> Hi Jan
>>
>> On 22.05.2020 10:20, Jan.Boogman at swisscom.com wrote:
>>
>>> every now and then I stumble over syncing problems like this, which seem
>>> to be caused by bad data in the db:
>>>
>>
>> looks like https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpeeringdb%2Fpeeringdb-py%2Fissues%2F38&data=02%7C01%7CJan.Boogman%40swisscom.com%7C3638f1a656c64f60fa0308d7fe553fea%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257514405318305&sdata=%2FCUuf0%2Bt2VgDVpH8ZJ%2FHZuIsx2gqRqfti9r%2FT7IKQ3w%3D&reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fpeeringdb%2Fpeeringdb-py%2Fissues%2F38&data=02%7C01%7CJan.Boogman%40swisscom.com%7C6985ccfd06324f2fd84108d7fe6976c9%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257601230415227&sdata=Ztf9Hb%2BgedjI0yFMU9lWSi%2FepYsWrpJEiTAdI9Mqb2I%3D&reserved=0>
> to me.
>> Could you please check?
>>
>>
>> Cheers
>> Arnold
>> --
>> Keep calm, keep distance, keep connected!
>>
>> Arnold Nipper
>> email: arnold at nipper.de
>> mobile: +49 172 2650958
>>
>>
>> _______________________________________________
>> Pdb-tech mailing list
>> Pdb-tech at lists.peeringdb.com
>> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.peeringdb.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpdb-tech&data=02%7C01%7CJan.Boogman%40swisscom.com%7C3638f1a656c64f60fa0308d7fe553fea%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257514405328235&sdata=7aN4bdzcc2%2BOqLirgwkpJz9fKrIq6eJ2ZKzQM1uwjbk%3D&reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.peeringdb.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpdb-tech&data=02%7C01%7CJan.Boogman%40swisscom.com%7C6985ccfd06324f2fd84108d7fe6976c9%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257601230415227&sdata=rszJqMVQypD5xFMAucnxUXQBUblQml2hSK7nI16JEd8%3D&reserved=0>
>>
> _______________________________________________
> Pdb-tech mailing list
> Pdb-tech at lists.peeringdb.com
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.peeringdb.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpdb-tech&data=02%7C01%7CJan.Boogman%40swisscom.com%7C3638f1a656c64f60fa0308d7fe553fea%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257514405328235&sdata=7aN4bdzcc2%2BOqLirgwkpJz9fKrIq6eJ2ZKzQM1uwjbk%3D&reserved=0<https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.peeringdb.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fpdb-tech&data=02%7C01%7CJan.Boogman%40swisscom.com%7C6985ccfd06324f2fd84108d7fe6976c9%7C364e5b87c1c7420d9beec35d19b557a1%7C1%7C0%7C637257601230425176&sdata=qGWULiH%2Fs3ugtYQ798apyhpU7kQL8U%2FTriiZOuemKuo%3D&reserved=0>
_______________________________________________
Pdb-tech mailing list
Pdb-tech at lists.peeringdb.com
https://lists.peeringdb.com/cgi-bin/mailman/listinfo/pdb-tech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.peeringdb.com/pipermail/pdb-tech/attachments/20200522/3e732f8f/attachment-0001.htm>


More information about the Pdb-tech mailing list