pyjen.node module

Declarations for the abstraction of a Jenkins build agent

class pyjen.node.Node(api)[source]

Bases: object

Wrapper around a Jenkins build agent (aka: Node) configuration

Use this class to manipulate agents managed by a Jenkins master

Parameters

api (/utils/jenkins_api/JenkinsAPI) – Pre-initialized connection to the Jenkins REST API

is_idle

Checks to see whether any executors are in use on this Node or not

Return type

bool

is_offline

Checks to see whether this Node is currently offline or not

Return type

bool

name

Gets the display name of this Node

Return type

str

number_of_executors

Returns the number of executors this node provides

Return type

int

toggle_offline(message=None)[source]

Toggles the online status of this Node

If the current state of this Node is “offline” it will be toggled to “online” and vice-versa.

Parameters

message (str) – optional descriptive message explaining the reason this node has been taken offline.

wait_for_idle(max_timeout=None)[source]

Blocks execution until this Node enters an idle state

Parameters

max_timeout (int) – The maximum amount of time, in seconds, to wait for an idle state. If this value is undefined, this method will block indefinitely.

Returns

True if the Node has entered idle state before returning otherwise returns False

Return type

bool