Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTX-6562: status command improvements. #261

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions coretex/cli/commands/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@

from ..modules import ui
from ..modules import node as node_module
from ..modules.node import NodeStatus
from ..modules.node import NodeStatus, getNodeStatus
from ..modules.user import initializeUserSession
from ..modules.utils import onBeforeCommandExecute, checkEnvironment
from ..modules.update import activateAutoUpdate, getNodeStatus
from ..modules.update import activateAutoUpdate
from ...utils import docker
from ...configuration import NodeConfiguration, InvalidConfiguration, ConfigurationNotFound

Expand Down Expand Up @@ -189,9 +189,8 @@ def status() -> None:
"busy": "cyan",
"reconnecting": "yellow"
}

statusEcho = click.style(nodeStatus.name, fg = statusColors[nodeStatus.name])
ui.stdEcho(f"Current status of node is {statusEcho}.")
click.echo(f"Node is {statusEcho}.")


@click.command()
Expand All @@ -207,9 +206,9 @@ def logs(tail: Optional[int], follow: bool, timestamps: bool) -> None:


@click.group()
@onBeforeCommandExecute(docker.isDockerAvailable)
@onBeforeCommandExecute(docker.isDockerAvailable, excludeSubcommands = ["status"])
@onBeforeCommandExecute(initializeUserSession)
@onBeforeCommandExecute(node_module.checkResourceLimitations)
@onBeforeCommandExecute(node_module.checkResourceLimitations, excludeSubcommands = ["status"])
@onBeforeCommandExecute(checkEnvironment)
def node() -> None:
pass
Expand Down
2 changes: 1 addition & 1 deletion coretex/cli/modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import inquirer

from ...node import NodeMode
from ...configuration import UserConfiguration, NodeConfiguration
from ...configuration import NodeConfiguration


def clickPrompt(
Expand Down
9 changes: 0 additions & 9 deletions coretex/cli/modules/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,3 @@ def activateAutoUpdate() -> None:

if not jobExists(str(updateScriptPath)):
scheduleJob(UPDATE_SCRIPT_NAME)


def getNodeStatus() -> NodeStatus:
try:
response = requests.get(f"http://localhost:21000/status", timeout = 1)
status = response.json()["status"]
return NodeStatus(status)
except:
return NodeStatus.inactive
Loading