Job

Just another Python API for Travis CI (API).

A module which provides the “Job” resource type.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Project link:
https://github.com/funilrys/PyTravisCI
Project documentation:
https://pytravisci.readthedocs.io/en/latest/

License

MIT License

Copyright (c) 2019, 2020 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyTravisCI.resource_types.job.Job(**kwargs)[source]

Bases: PyTravisCI.resource_types.base.ResourceTypesBase

Provides the description of a single build.

Official Travis CI API documentation
Variables:
  • id (int) – Value uniquely identifying the job.
  • allow_failure (bool) – The job’s allow_failure.
  • number (str) – Incremental number for a repository’s builds.
  • state (str) – Current state of the job.
  • started_at (datetime) – When the job started.
  • finished_at (datetime) – When the job finished.
  • build (Build) – The build the job is associated with.
  • queue (str) – Worker queue this job is/was scheduled on.
  • repository (Repository) – GitHub user or organization the job belongs to.
  • commit (Commit) – The commit the job is associated with.
  • owner – GitHub user or organization the job belongs to.
  • stage (List[:class`~PyTravisCI.resource_types.stage.Stage`]) – The stages of the job.
  • created_at (datetime) – When the job was created.
  • updated_at (datetime) – When the job was updated.
cancel() → PyTravisCI.resource_types.job.Job[source]

Cancels the current job.

debug() → PyTravisCI.resource_types.job.Job[source]

Restart the current job in debug mode.

Warning

This method may not work if you are not allowed to restart in debug mode.

get_log(*, params: Optional[dict] = None) → PyTravisCI.resource_types.log.Log[source]

Provides the logs of the current job.

Parameters:params – The query parameters to append to the URL.
is_active(*, sync: bool = False) → bool[source]

Checks if the jpb is active.

Parameters:sync – Authorizes the synchronization before checking.
is_canceled(*, sync: bool = False) → bool[source]

Checks if the job canceled.

Parameters:sync – Authorizes the synchronization before checking.
is_created(*, sync: bool = False) → bool[source]

Checks if the job is created.

Parameters:sync – Authorizes the synchronization before checking.
is_errored(*, sync: bool = False) → bool[source]

Checks if the job errored.

Parameters:sync – Authorizes the synchronization before checking.
is_failed(*, sync: bool = False) → bool[source]

Checks if the job failed.

Parameters:sync – Authorizes the synchronization before checking.
is_passed(*, sync: bool = False) → bool[source]

Checks if the job is passed.

Parameters:sync – Authorizes the synchronization before checking.
is_started(*, sync: bool = False) → bool[source]

Checks if the job is started.

Parameters:sync – Authorizes the synchronization before checking.
restart() → PyTravisCI.resource_types.job.Job[source]

Restarts the current job.

Raises:JobAlreadyStarted – When the current job was already started.
sync() → PyTravisCI.resource_types.job.Job[source]

Fetches the latest information of the current job.