Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export 504 Gateway Time-out #1165

Open
thom4parisot opened this issue Dec 16, 2024 Discussed in #1164 · 2 comments
Open

export 504 Gateway Time-out #1165

thom4parisot opened this issue Dec 16, 2024 Discussed in #1164 · 2 comments
Labels
bloquant ⛔ 🐞 bug [domain] export 📜 Module d'export multi-formats par défaut (depuis Stylo v2)

Comments

@thom4parisot
Copy link
Member

thom4parisot commented Dec 16, 2024

Discussed in #1164

Originally posted by Pixflowave December 13, 2024
Bonsoir,
je n'ai pas réussi à faire d'export .pdf ou .odt . Je n'ai réussi qu'a obtenir une version html incompléte ...

[2024-12-16 08:17:46,347] ERROR in app: Exception on /generique/export/stylo.huma-num.fr/5ced91acdac870001970e5d4/how-to-stylo/ [GET]
Traceback (most recent call last):
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 69, in map_httpcore_exceptions
    yield
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 233, in handle_request
    resp = self._pool.handle_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 216, in handle_request
    raise exc from None
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_sync/connection_pool.py", line 196, in handle_request
    response = connection.handle_request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 99, in handle_request
    raise exc
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 76, in handle_request
    stream = self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_sync/connection.py", line 122, in _connect
    stream = self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_backends/sync.py", line 205, in connect_tcp
    with map_exceptions(exc_map):
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 99] Cannot assign requested address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/views.py", line 240, in export
    article = get_article(
              ^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/views.py", line 121, in get_article
    article.fetch_all(templates_folder, force=force_download)
  File "/usr/stylo-export/styloexport/article.py", line 292, in fetch_all
    self.download_images(templates_folder, force=force)
  File "/usr/stylo-export/styloexport/article.py", line 39, in bail_on_errors
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/article.py", line 186, in download_images
    image_path = self._download_image(image, images_path, force)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/article.py", line 250, in _download_image
    response = client.get(image_url, follow_redirects=True, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 1054, in get
    return self.request(
           ^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 827, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 914, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 942, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_client.py", line 1015, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 232, in handle_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 86, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 99] Cannot assign requested address

J'ai une autre erreur dans un autre article :

[2024-12-16 08:27:39,149] ERROR in app: Exception on /generique/export/stylo.huma-num.fr/61b202628eded40012f59a3c/article-long-issue-502/ [GET]
Traceback (most recent call last):
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 1463, in wsgi_app
    response = self.full_dispatch_request()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 872, in full_dispatch_request
    rv = self.handle_user_exception(e)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 870, in full_dispatch_request
    rv = self.dispatch_request()
         ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/venv/lib/python3.11/site-packages/flask/app.py", line 855, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)  # type: ignore[no-any-return]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/views.py", line 240, in export
    article = get_article(
              ^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/views.py", line 121, in get_article
    article.fetch_all(templates_folder, force=force_download)
  File "/usr/stylo-export/styloexport/article.py", line 290, in fetch_all
    self.extract_metadata()
  File "/usr/stylo-export/styloexport/article.py", line 39, in bail_on_errors
    return wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/stylo-export/styloexport/article.py", line 152, in extract_metadata
    if abstract["lang"] == "fr":
       ~~~~~~~~^^^^^^^^
KeyError: 'lang'
@thom4parisot thom4parisot added 🐞 bug bloquant ⛔ [domain] export 📜 Module d'export multi-formats par défaut (depuis Stylo v2) labels Dec 16, 2024
@thom4parisot
Copy link
Member Author

@davidbgk je suis preneur d'aide sur ces bugs. J'ai ajouté les articles en question dans le workspace stylo-export-test ; j'ai test qu'en faisant l'export au format ODT. Tu saurais dire ce qui coince à l'aide des logs ci-dessus ?

@davidbgk
Copy link
Collaborator

La première erreur concerne une image qui n'arrive pas à être récupérée… mais il ne semble pas y avoir d'images dans ces articles 🤔

La seconde erreur c'est parce que la clé abstract du yaml ne contient pas la langue, je m'attends à une structure du type:

abstract:
  - lang: fr
    text: >-
      C'est article est un exemple d'article type édité sur Stylo. Stylo est un
      éditeur d'article scientifique dédié aux sciences humaines. […]

Et là on a:

abstract: >-
  On entend parfois des mots lourds de préjugés sur la maladie mentale, au
  détour d’une publicité, d’un film ou d’un magazine. On parle de « folie, de
  dérangés, de fuckés et d’anormaux ». Malgré un progrès notable dans les
  dernières années, les troubles de santé mentale sont encore stigmatisés. […]

Note que dans mon code j'ai un commentaire en TODO 😅 que l'on pourrait peut-être tenter de résoudre au passage.

Je peux passer à un mode plus défensif là-dessus, en commençant par une arborescence, puis une autre en fallback, puis une langue par défaut en fallback etc. Quelles sont les pratiques d'écritures « correctes » à ce sujet ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bloquant ⛔ 🐞 bug [domain] export 📜 Module d'export multi-formats par défaut (depuis Stylo v2)
Projects
None yet
Development

No branches or pull requests

2 participants