pyjen.queue_item module

Abstraction around a scheduled build contained in the Jenkins build queue

class pyjen.queue_item.QueueItem(api)[source]

Bases: object

Abstraction around a scheduled build contained in the Jenkins build queue

Parameters

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

blocked

Is this scheduled build waiting for some other event to complete?

May return None if this queue item has been invalidated by Jenkins

Return type

bool

build

Once this scheduled build leaves the queue, this property returns a reference to the running build. While the item is still queued, this property returns None.

See the ‘waiting’ property on this object for a way to detect whether a queued item has left the queue or not.

buildable

TBD

May return None if this queue item has been invalidated by Jenkins

Return type

bool

cancel()[source]

Cancels this queued build

cancelled

Has this queued build been cancelled?

May return None if this queue item has been invalidated by Jenkins

Return type

bool

is_valid()[source]

Checks to make sure the queue item this object manages still exists

Jenkins periodically expires / invalidates queue items server-side. There is no way for us to detect or predict when this will happen. When it does, this client-side queue item object will no longer refer to a valid REST API endpoint. This helper method helps users of the PyJen library check to see if the object still points to a valid queue item.

Return type

bool

job

Gets the Jenkins job associated with this scheduled build

May return None if this queue item has been invalidated by Jenkins

Return type

pyjen.job.Job

reason

Descriptive text explaining why this build is still in the queue

May return None if this queue item has been invalidated by Jenkins

Return type

str

stuck

Is this scheduled build blocked / unable to build?

May return None if this queue item has been invalidated by Jenkins

Return type

bool

uid

Gets the numeric identifier of this queued build

Guaranteed to return a valid identifier, even when the queue item this object refers to has been invalidated by Jenkins.

Return type

int

waiting

Is this queue item still waiting in the queue?

May return None if this queue item has been invalidated by Jenkins

Return type

bool