Giter Club home page Giter Club logo

Comments (8)

dpdoughe avatar dpdoughe commented on July 23, 2024

Note the error You must provide the paste --ini argument is coming from pyramid-celery here

print('You must provide the paste --ini argument')

while the got an unexpected keyword argument 'ini' is coming from Celery

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

I'm wondering if a possible path forward is instead of using a preload options, which seem to add these options to all commands,

celery_app.user_options['preload'].add()

e.g.,

celery_app.user_options['preload'].add(
Option(
('--ini', '-i',),
help='Paste ini configuration file.'
)
)
celery_app.user_options['preload'].add(
Option(
('--ini-var',),
help='Comma separated list of key=value to pass to ini.'
)
)

you could instead specify which particular commands should use your ini and ini_var options as mentioned in https://github.com/celery/celery/blob/e7b47a62d789557cf18ed0e56e2dfb99a51a62f7/docs/userguide/extending.rst#adding-new-command-line-options

        ini_option = Option(
            ('--ini', '-i',),
            help='Paste ini configuration file.'
        )
        ini_var_option = Option(
            ('--ini-var',),
            help='Comma separated list of key=value to pass to ini.'
        )
        # TODO: Add "shell" to list if Celery developers will add the "allow_extra_args" 
        # context flag to shell command  
        # https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/shell.py#L82
        for option in ['worker','beat']:
            celery_app.user_options[option].add(
                ini_option
            )
            celery_app.user_options[option].add(
                ini_var_option
            )

This approach does seem to be working fine for me because Celery's Beat and Worker command already specify

context_settings={
    'allow_extra_args': True
}

See for example: https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/beat.py#L11

I left a TODO above because, currently this isn't working for the shell command because Celery does not (yet) specify allow_extra_args in its context settings. See e.g., https://github.com/celery/celery/blob/f3a2cf45a69b443cac6c79a5c85583c8bd91b0a3/celery/bin/shell.py#L82

I've verified this solution works for worker and beat commands already and the Celery docs suggest it will work for events command too. If a feature request were made to Celery for the change to shell command to add the allow_extra_args, do you think this could provide a path forward?

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

Also, correct me if I am wrong, while shell does need ini interaction, to get all the registered tasks, it doesn't seem like purge functionality would require ini interaction.

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

I've created a feature request ticket in Celery celery/celery#8259

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

@sontek, can you comment on the proposed approach?

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

The Celery project has now officially release their 5.3.1 https://pypi.org/project/celery/5.3.1

This inability to configure and run purge or shell commands with pyramid_celery persists with Celery v5.3.1

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

@sontek my pull request to Celery has been merged bringing back preload options support for purge and shell. See celery/celery#8374

I believe no code changes will be needed in pyramid-celery. We still need to confirm once a new release of Celery is available.

from pyramid_celery.

dpdoughe avatar dpdoughe commented on July 23, 2024

Purge, shell, inspect etc have been restored to accepting ini options from Pyramid-Celery as a result of resolution of celery/celery#8374

from pyramid_celery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.