Adding timeout for more cli actions

Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2023-03-09 14:25:39 +03:00 committed by Gitea
parent 8ed26cef7d
commit f2ecce44bf
6 changed files with 57 additions and 19 deletions

View file

@ -13,6 +13,7 @@ class FrostfsCliNetmap(CliCommand):
generate_key: bool = False,
ttl: Optional[int] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Get current epoch number.
@ -24,6 +25,7 @@ class FrostfsCliNetmap(CliCommand):
ttl: TTL value in request meta header (default 2).
wallet: Path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -41,6 +43,7 @@ class FrostfsCliNetmap(CliCommand):
generate_key: bool = False,
ttl: Optional[int] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Get information about FrostFS network.
@ -52,6 +55,7 @@ class FrostfsCliNetmap(CliCommand):
ttl: TTL value in request meta header (default 2)
wallet: Path to the wallet or binary key
xhdr: Request X-Headers in form of Key=Value
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -70,6 +74,7 @@ class FrostfsCliNetmap(CliCommand):
json: bool = False,
ttl: Optional[int] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Get target node info.
@ -82,6 +87,7 @@ class FrostfsCliNetmap(CliCommand):
ttl: TTL value in request meta header (default 2).
wallet: Path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -99,6 +105,7 @@ class FrostfsCliNetmap(CliCommand):
generate_key: bool = False,
ttl: Optional[int] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Request current local snapshot of the network map.
@ -110,6 +117,7 @@ class FrostfsCliNetmap(CliCommand):
ttl: TTL value in request meta header (default 2).
wallet: Path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.

View file

@ -13,6 +13,7 @@ class FrostfsCliShards(CliCommand):
id: Optional[list[str]],
address: Optional[str] = None,
all: bool = False,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Flush objects from the write-cache to the main storage.
@ -24,6 +25,7 @@ class FrostfsCliShards(CliCommand):
endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
wallet: WIF (NEP-2) string or path to the wallet or binary key.
wallet_password: Wallet password.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -44,6 +46,7 @@ class FrostfsCliShards(CliCommand):
address: Optional[str] = None,
all: bool = False,
clear_errors: bool = False,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Set work mode of the shard.
@ -57,12 +60,13 @@ class FrostfsCliShards(CliCommand):
endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
wallet: WIF (NEP-2) string or path to the wallet or binary key.
wallet_password: Wallet password.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
"""
return self._execute_with_password(
f"control shards set-mode",
"control shards set-mode",
wallet_password,
**{
param: value
@ -80,6 +84,7 @@ class FrostfsCliShards(CliCommand):
path: str,
address: Optional[str] = None,
no_errors: bool = False,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Dump objects from shard to a file.
@ -92,12 +97,13 @@ class FrostfsCliShards(CliCommand):
endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
wallet: WIF (NEP-2) string or path to the wallet or binary key.
wallet_password: Wallet password.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
"""
return self._execute_with_password(
f"control shards dump",
"control shards dump",
wallet_password,
**{
param: value
@ -113,6 +119,7 @@ class FrostfsCliShards(CliCommand):
wallet_password: str,
address: Optional[str] = None,
json_mode: bool = False,
timeout: Optional[str] = None,
) -> CommandResult:
"""
List shards of the storage node.
@ -123,12 +130,13 @@ class FrostfsCliShards(CliCommand):
endpoint: Remote node address (as 'multiaddr' or '<host>:<port>').
wallet: WIF (NEP-2) string or path to the wallet or binary key.
wallet_password: Wallet password.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
"""
return self._execute_with_password(
f"control shards list",
"control shards list",
wallet_password,
**{
param: value

View file

@ -16,6 +16,7 @@ class FrostfsCliStorageGroup(CliCommand):
lifetime: Optional[int] = None,
address: Optional[str] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Put storage group to FrostFS.
@ -30,6 +31,7 @@ class FrostfsCliStorageGroup(CliCommand):
ttl: TTL value in request meta header.
wallet: WIF (NEP-2) string or path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -52,6 +54,7 @@ class FrostfsCliStorageGroup(CliCommand):
lifetime: Optional[int] = None,
address: Optional[str] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Get storage group from FrostFS.
@ -67,6 +70,7 @@ class FrostfsCliStorageGroup(CliCommand):
ttl: TTL value in request meta header.
wallet: WIF (NEP-2) string or path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -87,6 +91,7 @@ class FrostfsCliStorageGroup(CliCommand):
lifetime: Optional[int] = None,
address: Optional[str] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
List storage groups in FrostFS container.
@ -101,6 +106,7 @@ class FrostfsCliStorageGroup(CliCommand):
ttl: TTL value in request meta header.
wallet: WIF (NEP-2) string or path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.
@ -122,6 +128,7 @@ class FrostfsCliStorageGroup(CliCommand):
lifetime: Optional[int] = None,
address: Optional[str] = None,
xhdr: Optional[dict] = None,
timeout: Optional[str] = None,
) -> CommandResult:
"""
Delete storage group from FrostFS.
@ -137,6 +144,7 @@ class FrostfsCliStorageGroup(CliCommand):
ttl: TTL value in request meta header.
wallet: WIF (NEP-2) string or path to the wallet or binary key.
xhdr: Dict with request X-Headers.
timeout: Timeout for an operation (default 15s).
Returns:
Command's result.