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

Exception handling and logging errors when the configuration file path is specified incorrectly and is the default path #1391

Open
fallingin opened this issue Aug 8, 2024 · 0 comments
Labels

Comments

@fallingin
Copy link

The log show that the service started successfully,but unable to access flower ui.

# wrong but default path
celery flower --conf=tasks/flowerconfig.py
[I 240807 17:43:06 command:168] Visit me at http://0.0.0.0:5555
[I 240807 17:43:06 command:176] Broker: redis://:**@127.0.0.1:6379/0
[I 240807 17:43:06 command:177] Registered tasks: 
    ['celery.accumulate',
     'celery.backend_cleanup',
     'celery.chain',
     'celery.chord',
     'celery.chord_unlock',
     'celery.chunks',
     'celery.group',
     'celery.map',
     'celery.starmap',
     'hs.reset_device',
     'hs.start_hs',
     'test_spider']
[I 240807 17:43:06 mixins:228] Connected to redis://:**@127.0.0.1:6379/0
# correct path in another folder
celery flower --conf=configs/flowerconfig.py

The log shows a "Visit me at http://0.0.0.0:5555". I tried the following

# 8000 is in my configuration file
http://0.0.0.0:5555 # Cannot access
http://0.0.0.0:8000 # Cannot access
http://127.0.0.1:5555 # Have access
http://127.0.0.1:8000 # Cannot access

The code did not catch the wrong path exception, and the log showed the wrong default address.

When opening the error path file and generating an I/O exception, the error path is ignored if it is the default path.

flower/flower/command.py

Lines 87 to 92 in 58136bf

try:
parse_config_file(os.path.abspath(options.conf), final=False)
parse_command_line([prog_name] + argv)
except IOError:
if os.path.basename(options.conf) != DEFAULT_CONFIG_FILE:
raise

No default value is specified for the address.

flower/flower/options.py

Lines 12 to 13 in 58136bf

define("address", default='',
help="run on the given address", type=str)

If the address is None, the tornado server listens to 0.0.0.0.

When address is None, the default print value should not be 0.0.0.0 but 127.0.0.1 and the LAN address and the public address.

flower/flower/command.py

Lines 168 to 172 in 58136bf

logger.info(
"Visit me at http%s://%s:%s%s", 's' if ssl else '',
options.address or '0.0.0.0', options.port,
prefix_str
)

@fallingin fallingin added the bug label Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant