Skip to content

Use string value for CELERY_SKIP_CHECKS envvar#8462

Merged
auvipy merged 6 commits intocelery:mainfrom
jennifer-richards:skip-checks
Sep 2, 2023
Merged

Use string value for CELERY_SKIP_CHECKS envvar#8462
auvipy merged 6 commits intocelery:mainfrom
jennifer-richards:skip-checks

Conversation

@jennifer-richards
Copy link
Copy Markdown
Contributor

@jennifer-richards jennifer-richards commented Aug 29, 2023

Description

Sets the CELERY_SKIP_CHECKS value to a string value ('true') instead of a Boolean. Updates the existing test to patch in this string value instead of True

An integration test that validates that command line argument handling in celery/bin/celery.py matches the unit test assumptions would be a nice addition. However, since it should test more than just this option, it is far enough afield that I have not added it.

Fixes #8461.

@codecov
Copy link
Copy Markdown

codecov bot commented Aug 29, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.01% 🎉

Comparison is base (dabccf0) 87.42% compared to head (11c772b) 87.44%.
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8462      +/-   ##
==========================================
+ Coverage   87.42%   87.44%   +0.01%     
==========================================
  Files         148      148              
  Lines       18488    18488              
  Branches     3155     3155              
==========================================
+ Hits        16164    16166       +2     
+ Misses       2034     2033       -1     
+ Partials      290      289       -1     
Flag Coverage Δ
unittests 87.40% <100.00%> (+0.01%) ⬆️

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

Files Changed Coverage Δ
celery/bin/celery.py 73.17% <100.00%> (+1.62%) ⬆️

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

Copy link
Copy Markdown
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

approving on principle. but are we sure we don not have any other edge case?

@jennifer-richards
Copy link
Copy Markdown
Contributor Author

approving on principle. but are we sure we don not have any other edge case?

Is there a particular edge you're concerned about?

As I mentioned, if I understand the tests correctly, there is a fairly glaring shortcoming: there's no test that the --skip-checks option to the cli utility feeds the expected value into CELERY_SKIP_CHECKS in the environment. In fact, there's no test at all that the --skip-checks option doesn't entirely crash the utility (which it, in fact, did prior to this patch).

There's also something between a bug and a lack of documentation about the CELERY_SKIP_CHECKS variable. The documentation for it says, generically, "Provide a default value..." without any mention of how the value is interpreted. Any truthy value (i.e., non-empty string) is interpreted as "skip the initial checks." I hesitated to use the value 'true' here because that falsely suggests that setting CELERY_SKIP_CHECKS=false might disable it. (IMO a check similar to the strtobool() utility in the serializer code would be ideal, but a quick scan of the code base found at least one other place where the simpler truthiness check was applied to an environment variable used as a flag.)

I'd be happy to capture these as tickets, but imo they're substantive enough that I didn't want to start addressing them as a drive-by. Someone more involved in the project needs to think about them.

@auvipy
Copy link
Copy Markdown
Member

auvipy commented Aug 31, 2023

should we at least correct some of the doc issues in this PR? I am OK to merge this soon

@jennifer-richards
Copy link
Copy Markdown
Contributor Author

jennifer-richards commented Aug 31, 2023

Sure. I think the Provide a default for --skip-checks is coming from sphinx-click and I don't see a way to adjust that. Instead, I've added text to the --skip-checks help that should make it clear.

I'm going to separately push a minor tweak to the CLI documentation to point out that the environment variables all need a CELERY_ prefix. (edit: done, it's #8469)

Copy link
Copy Markdown
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

we need to fix the lint errors and possible some additional test case to improve the test coverage. can you please put some effort on that?

@auvipy auvipy added this to the 5.3.x milestone Sep 1, 2023
@jennifer-richards
Copy link
Copy Markdown
Contributor Author

I think that should eliminate the lint and improve the coverage.

@jennifer-richards
Copy link
Copy Markdown
Contributor Author

Tests appear to be failing, but it's not clear to me why. If there's something specific to be done please let me know but I'm at the limit of my familiarity with the project and my time available to debug.

@auvipy auvipy merged commit 1aff856 into celery:main Sep 2, 2023
@jennifer-richards jennifer-richards deleted the skip-checks branch September 2, 2023 11:57
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.

Running worker with --skip-checks option fails with a TypeError

2 participants