Bug description

4.1.3.post1 distribution is missing 'superset.commands.logs' module, and scheduler fails to start:

Unable to load celery application.
While trying to load the module superset.tasks.celery_app:app the following error occurred:
Traceback (most recent call last):
  File "/opt/superset/lib/python3.11/site-packages/celery/bin/celery.py", line 141, in celery
    app = find_app(app)
          ^^^^^^^^^^^^^
  File "/opt/superset/lib/python3.11/site-packages/celery/app/utils.py", line 383, in find_app
    sym = symbol_by_name(app, imp=imp)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/superset/lib/python3.11/site-packages/kombu/utils/imports.py", line 59, in symbol_by_name
    module = imp(module_name, package=package, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/superset/lib/python3.11/site-packages/celery/utils/imports.py", line 109, in import_from_cwd
    return imp(module, package=package)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/Python-3.11/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/superset/lib/python3.11/site-packages/superset/tasks/celery_app.py", line 37, in <module>
    from . import cache, scheduler
  File "/opt/superset/lib/python3.11/site-packages/superset/tasks/scheduler.py", line 28, in <module>
    from superset.commands.logs.prune import LogPruneCommand
ModuleNotFoundError: No module named 'superset.commands.logs'

Screenshots/recordings

If you install superset package locally, it's easy to see:

% ls ./.venv/lib/python3.11/site-packages/superset/commands/ 
__init__.py     base.py         dashboard       distributed_lock    export          report          tag
__pycache__     chart           database        exceptions.py       importers       security        temporary_cache
annotation_layer    css         dataset         explore         query           sql_lab         utils.py

Superset version

4.1.3

Python version

3.11

Node version

Not applicable

Browser

Not applicable

Additional context

No response

Checklist

  • [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
  • [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
  • [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.

Comment From: dosubot[bot]

Hi @Khrol! I'm Dosu and I’m helping the superset team.

The missing superset.commands.logs module in 4.1.3.post1 is almost certainly a packaging oversight, not an intentional removal or code regression. This module (and specifically LogPruneCommand) is present in the source code and is required for the scheduler to function. Similar issues have occurred in other versions due to packaging errors, and the recommended workaround is to manually copy the missing logs directory (with prune.py) from the corresponding source release/tag into your installed superset/commands/ directory. This should resolve the import error and allow the scheduler to start as expected. For reference, see the discussion of a nearly identical issue in a later version and confirmation that LogPruneCommand is expected to be present and used by the scheduler citation citation.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

Comment From: hainenber

Thanks for catching this, @Khrol! We fixed in 5.0.0 via this PR but it's not yet backported to v4.

cc @sadpandajoe