Projet

Général

Profil

Development #44021

Le code dans hobo.multitenant.threads ne fonctionne pas en python3

Ajouté par Frédéric Péters il y a presque 4 ans. Mis à jour il y a presque 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Catégorie:
-
Version cible:
-
Début:
12 juin 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

   [passerelle-hautes-alpes.test.entrouvert.org] ERROR: error running hourly job (TypeError('super(type, obj): obj must be an instance or subtype of type',))
   ERROR: TypeError: super(type, obj): obj must be an instance or subtype of type
   ERROR:   File "/usr/lib/python3/dist-packages/hobo/multitenant/threads.py", line 34, in __init__
   ERROR:
   ERROR:     super(TenantAwareThread, self).__init__(*args, **kwargs)
   ERROR:   File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1731, in run
   ERROR:     self.__timer = threading.Timer(float(timeout), self.read_timer)
   ERROR:   File "/usr/lib/python3.5/threading.py", line 1166, in __init__
   ERROR:     Thread.__init__(self)
   ERROR:   File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 201, in start_handshake
   ERROR:     self.packetizer.start_handshake(self.handshake_timeout)
   ERROR: Traceback (most recent call last):
   ERROR: Unknown exception: super(type, obj): obj must be an instance or subtype of type


Fichiers

Révisions associées

Révision 6361be78 (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

tests_multitenant: test threading.Timer (#44021)

Révision c448546d (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

py3: adapt support of multitenant in threads (#44021)

Historique

#1

Mis à jour par Thomas Noël il y a presque 4 ans

J'ai regardé sans avoir rien vu : l'endroit où un hourly utilise paramiko, c'est mdel_ddpacs

#2

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Ok c'est paramiko qui lance des threads et le code thread/tenant-aware de hobo qui interagissent, et pour les logs verbeux ça doit venir d'une interception d'exception par paramiko parce que ça vient du logger paramiko.transport qui n'est clairement pas à nous. Je vais regarder ça, la correction sera vraisemblablement dans hobo.

#3

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Projet changé de Passerelle à Hobo
  • Sujet changé de error running hourly job (TypeError('super(type, obj): obj must be an instance or subtype of type',)) à Le code dans hobo.multitenant.threads ne fonctionne pas en python3
  • Assigné à mis à Benjamin Dauvergne

A priori là c'est la différence entre ça (py27) :

def Timer(*args, **kwargs):
    """Factory function to create a Timer object.

    Timers call a function after a specified number of seconds:

        t = Timer(30.0, f, args=[], kwargs={})
        t.start()
        t.cancel()     # stop the timer's action if it's still waiting

    """ 
    return _Timer(*args, **kwargs)

et ça (py38):

class Timer(Thread):
    """Call a function after a specified number of seconds:

            t = Timer(30.0, f, args=None, kwargs=None)
            t.start()
            t.cancel()     # stop the timer's action if it's still waiting

    """ 

on continue à définir threading._Timer qui n'existe plus.

#6

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

#8

Mis à jour par Serghei Mihai il y a presque 4 ans

Il reste un import sys non-utilisé.
Sinon looks good for me, mais je laisse d'autres regards dire quoi.

#9

Mis à jour par Serghei Mihai il y a presque 4 ans

  • Statut changé de Solution proposée à Solution validée
#10

Mis à jour par Frédéric Péters il y a presque 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)

J'ai poussé les commits.

commit c448546dbe0ffddaef4959c9f2cfd88b5d154afa
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Mon Jun 15 11:56:12 2020 +0200

    py3: adapt support of multitenant in threads (#44021)

commit 6361be78c9dc84237fd145c6916a910356014189
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Mon Jun 15 11:55:49 2020 +0200

    tests_multitenant: test threading.Timer (#44021)
#11

Mis à jour par Frédéric Péters il y a presque 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée

Formats disponibles : Atom PDF