Job queues in python with asyncio and redis. CLI to run the arq worker.
(*, worker_settings: str, burst: bool, check: bool, watch: str, verbose: bool, custom_log_dict: str)
| 31 | @click.option('-v', '--verbose', is_flag=True, help=verbose_help) |
| 32 | @click.option('--custom-log-dict', type=str, help=logdict_help) |
| 33 | def cli(*, worker_settings: str, burst: bool, check: bool, watch: str, verbose: bool, custom_log_dict: str) -> None: |
| 34 | """ |
| 35 | Job queues in python with asyncio and redis. |
| 36 | |
| 37 | CLI to run the arq worker. |
| 38 | """ |
| 39 | sys.path.append(os.getcwd()) |
| 40 | worker_settings_ = cast('WorkerSettingsType', import_string(worker_settings)) |
| 41 | if custom_log_dict: |
| 42 | log_config = import_string(custom_log_dict) |
| 43 | else: |
| 44 | log_config = default_log_config(verbose) |
| 45 | logging.config.dictConfig(log_config) |
| 46 | |
| 47 | if check: |
| 48 | exit(check_health(worker_settings_)) |
| 49 | else: |
| 50 | kwargs = {} if burst is None else {'burst': burst} |
| 51 | if watch: |
| 52 | asyncio.run(watch_reload(watch, worker_settings_)) |
| 53 | else: |
| 54 | run_worker(worker_settings_, **kwargs) |
| 55 | |
| 56 | |
| 57 | async def watch_reload(path: str, worker_settings: 'WorkerSettingsType') -> None: |
no test coverage detected