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

Fix awx-manage run_wsrelay --status #14997

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

TheRealHaoLiu
Copy link
Member

SUMMARY

by don't start the metrics server if --status is passed in

example exception

sh-5.1# awx-manage run_wsrelay --status
/usr/local/bin/awx-manage:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
2024-03-14 18:35:12,885 ERROR    [-] awx.main.analytics MetricsServer failed to start for service 'websockets.
Traceback (most recent call last):
  File "/usr/local/bin/awx-manage", line 9, in <module>
    load_entry_point('awx', 'console_scripts', 'awx-manage')()
  File "/awx_devel/awx/__init__.py", line 177, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/run_wsrelay.py", line 95, in handle
    WebsocketsMetricsServer().start()
  File "/awx_devel/awx/main/analytics/subsystem_metrics.py", line 39, in start
    prometheus_client.start_http_server(self.port(), addr='localhost', registry=self._registry)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/prometheus_client/exposition.py", line 221, in start_wsgi_server
    httpd = make_server(addr, port, app, TmpServer, handler_class=_SilentHandler)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/wsgiref/simple_server.py", line 154, in make_server
    server = server_class((host, port), handler_class)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/usr/lib64/python3.11/wsgiref/simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "/usr/lib64/python3.11/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib64/python3.11/socketserver.py", line 472, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
sh-5.1# awx-manage run_wsrelay --status
/usr/local/bin/awx-manage:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import load_entry_point
2024-03-14 18:38:00,789 ERROR    [-] awx.main.analytics MetricsServer failed to start for service 'websockets.
Traceback (most recent call last):
  File "/usr/local/bin/awx-manage", line 9, in <module>
    load_entry_point('awx', 'console_scripts', 'awx-manage')()
  File "/awx_devel/awx/__init__.py", line 177, in manage
    execute_from_command_line(sys.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/django/core/management/base.py", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/awx_devel/awx/main/management/commands/run_wsrelay.py", line 95, in handle
    WebsocketsMetricsServer().start()
  File "/awx_devel/awx/main/analytics/subsystem_metrics.py", line 39, in start
    prometheus_client.start_http_server(self.port(), addr='localhost', registry=self._registry)
  File "/var/lib/awx/venv/awx/lib64/python3.11/site-packages/prometheus_client/exposition.py", line 221, in start_wsgi_server
    httpd = make_server(addr, port, app, TmpServer, handler_class=_SilentHandler)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/wsgiref/simple_server.py", line 154, in make_server
    server = server_class((host, port), handler_class)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/socketserver.py", line 456, in __init__
    self.server_bind()
  File "/usr/lib64/python3.11/wsgiref/simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "/usr/lib64/python3.11/http/server.py", line 136, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib64/python3.11/socketserver.py", line 472, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API
AWX VERSION

ADDITIONAL INFORMATION

by don't start the metrics server if --status is passed in
@TheRealHaoLiu TheRealHaoLiu merged commit 615f092 into ansible:devel Mar 14, 2024
21 of 22 checks passed
AlanCoding pushed a commit to AlanCoding/awx that referenced this pull request Mar 18, 2024
by don't start the metrics server if --status is passed in
djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
by don't start the metrics server if --status is passed in
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
by don't start the metrics server if --status is passed in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants