NodeCLI
demote
demote(x)
Demote one or more nodes from manager in the swarm
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidNode, List[ValidNode]]
|
One or a list of nodes. |
required |
inspect
inspect(x)
Returns a python_on_whales.Node
object from a string
(id or hostname of the node)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[str, List[str]]
|
One id or hostname or a list of ids or hostnames |
required |
Returns
One or a list of `python_on_whales.Node`
list
list()
Returns the list of nodes in this swarm.
Returns
A `List[python_on_whales.Node]`
promote
promote(x)
Promote one or more nodes to manager in the swarm
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidNode, List[ValidNode]]
|
One or a list of nodes. |
required |
ps
ps(x=None)
Returns the list of swarm tasks running on one or more nodes.
from python_on_whales import docker
tasks = docker.node.ps("my-node-name")
print(tasks[0].desired_state)
# running
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidNode, List[ValidNode], None]
|
One or more nodes (can be id, name or |
None
|
Returns
`List[python_on_whales.Task]`
remove
remove(x, force=False)
Remove one or more nodes from the swarm
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Union[ValidNode, List[ValidNode]]
|
One node or a list of nodes. You can use the id or the hostname of a node.
You can also use a |
required |
force |
bool
|
Force remove a node from the swarm |
False
|
update
update(node, availability=None, labels_add={}, rm_labels=[], role=None)
Updates a Swarm node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
ValidNode
|
The node to update, you can use a string or a |
required |
availability |
Optional[str]
|
Availability of the node ("active"|"pause"|"drain") |
None
|
labels_add |
Dict[str, str]
|
Remove a node label if exists |
{}
|
rm_labels |
List[str]
|
Labels to remove from the node. |
[]
|
role |
Optional[str]
|
Role of the node ("worker"|"manager") |
None
|