()
| 33 | |
| 34 | |
| 35 | def get_node_status() -> dict[str, str | int | None | uuid.UUID]: |
| 36 | consumer_running = ( |
| 37 | octobot_node.scheduler.SCHEDULER.INSTANCE |
| 38 | and octobot_node.scheduler.SCHEDULER.INSTANCE._launched |
| 39 | ) |
| 40 | is_running = octobot_node.config.settings.IS_MASTER_MODE or bool(consumer_running) |
| 41 | status = "running" if is_running else "stopped" |
| 42 | |
| 43 | backend_type = "postgres" if octobot_node.config.settings.SCHEDULER_POSTGRES_URL else "sqlite" |
| 44 | workers = 1 |
| 45 | |
| 46 | if octobot_node.config.settings.IS_MASTER_MODE: |
| 47 | node_type = "both" |
| 48 | elif octobot_node.config.settings.CONSUMER_ONLY: |
| 49 | node_type = "consumer" |
| 50 | else: |
| 51 | # no worker should run |
| 52 | node_type = "none" |
| 53 | workers = 0 |
| 54 | |
| 55 | return { |
| 56 | "node_type": node_type, |
| 57 | "backend_type": backend_type, |
| 58 | "workers": workers, |
| 59 | "status": status, |
| 60 | "redis_url": None, |
| 61 | "sqlite_file": octobot_node.config.settings.SCHEDULER_SQLITE_FILE if not octobot_node.config.settings.SCHEDULER_POSTGRES_URL else None, |
| 62 | } |
| 63 | |
| 64 | |
| 65 | async def get_automation_states( |
no outgoing calls