def run_from_argv(self, argv): # The "celery" command uses Click, which directly relies upon # `sys.argv`. So we must explicitly remove "celery" from `sys.argv` so # that we can directly invoke Click ourselves, letting it work with the # args unhindered as if "celery" instead of "nautobot-server" were the # root command that was called from the CLI. sys.argv.remove("celery") celery_main.main()
def start(self, argv=None): from celery.bin.celery import celery celery.params[0].default = self try: celery.main(args=argv, standalone_mode=False) except Exit as e: return e.exit_code finally: celery.params[0].default = None
def start(self, argv=None): """Run :program:`celery` using `argv`. Uses :data:`sys.argv` if `argv` is not specified. """ from celery.bin.celery import celery celery.params[0].default = self if argv is None: argv = sys.argv try: celery.main(args=argv, standalone_mode=False) except Exit as e: return e.exit_code finally: celery.params[0].default = None