Skip to content

feat(beat): add --json option for structured startup output - #9726

Open
Jenny1108 wants to merge 2 commits into
celery:mainfrom
Jenny1108:feature/beat-json-output
Open

Jenny1108 wants to merge 2 commits into
celery:mainfrom
Jenny1108:feature/beat-json-output

Conversation

@Jenny1108

Copy link
Copy Markdown

Description

This PR adds a new --json option to the celery beat command that outputs startup configuration information in structured JSON format instead of the traditional human-readable banner format.

What's Changed

  • Added --json / -j command line option to celery beat
  • Modified celery/bin/beat.py to accept the new JSON flag
  • Updated celery/apps/beat.py to support JSON output format
  • Maintained full backward compatibility with existing text output

JSON Output Format

When using celery beat --json, the output now includes:

{
  "localtime": "2025-05-24T00:02:16",
  "configuration": {
    "broker": "amqp://guest:**@localhost:5672//",
    "loader": "celery.loaders.default.Loader",
    "scheduler": "celery.beat.PersistentScheduler",
    "db": "celerybeat-schedule",
    "logfile": "[stderr]@%WARNING",
    "maxinterval": "5.00 minutes (300s)"
  }
}

@codecov

codecov Bot commented May 24, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 43.75000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.48%. Comparing base (778b009) to head (4460fd3).
⚠️ Report is 100 commits behind head on main.

Files with missing lines Patch % Lines
celery/apps/beat.py 40.00% 7 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9726      +/-   ##
==========================================
- Coverage   78.51%   78.48%   -0.04%     
==========================================
  Files         153      153              
  Lines       19127    19140      +13     
  Branches     2533     2535       +2     
==========================================
+ Hits        15018    15022       +4     
- Misses       3821     3828       +7     
- Partials      288      290       +2     
Flag Coverage Δ
unittests 78.46% <43.75%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@auvipy
auvipy self-requested a review May 27, 2025 07:58
@auvipy auvipy added this to the 5.7.0 milestone May 27, 2025

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the patch. we will also need unit tests to verify this changes.

@Nusnus
Nusnus force-pushed the feature/beat-json-output branch from 690795e to 4460fd3 Compare May 31, 2025 21:07
@auvipy auvipy modified the milestones: 5.7.0, 5.8.0 Aug 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants