返回介绍

3.8.15. Workers connector

发布于 2023-09-20 23:50:40 字数 7479 浏览 0 评论 0 收藏 0

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.15. Workers connector

class buildbot.db.workers.WorkersConnectorComponent

This class handles Buildbot’s notion of workers. The worker information is returned as a dictionary with the following keys:

  • id

  • name - the name of the worker

  • workerinfo - worker information as dictionary

  • paused - boolean indicating worker is paused and shall not take new builds

  • graceful - boolean indicating worker will be shutdown as soon as build finished

  • connected_to - a list of masters, by ID, to which this worker is currently connected. This list will typically contain only one master, but in unusual circumstances the same worker may appear to be connected to multiple masters simultaneously

  • configured_on - a list of master-builder pairs, on which this worker is configured. Each pair is represented by a dictionary with keys buliderid and masterid

The worker information can be any JSON-able object. See worker for more detail.

findWorkerId(name=name)
Parameters:

name (50-character identifier) – worker name

Returns:

worker ID via Deferred

Get the ID for a worker, adding a new worker to the database if necessary. The worker information for a new worker is initialized to an empty dictionary.

getWorkers(masterid=None, builderid=None)
Parameters:
  • masterid (integer) – limit to workers configured on this master

  • builderid (integer) – limit to workers configured on this builder

Returns:

list of worker dictionaries, via Deferred

Get a list of workers. If either or both of the filtering parameters either specified, then the result is limited to workers configured to run on that master or builder. The configured_on results are limited by the filtering parameters as well. The connected_to results are limited by the masterid parameter.

getWorker(workerid=None, name=None, masterid=None, builderid=None)
Parameters:
  • name (string) – the name of the worker to retrieve

  • workerid (integer) – the ID of the worker to retrieve

  • masterid (integer) – limit to workers configured on this master

  • builderid (integer) – limit to workers configured on this builder

Returns:

info dictionary or None, via Deferred

Looks up the worker with the given name or ID, returning None if no matching worker is found. The masterid and builderid arguments function as they do for getWorkers.

workerConnected(workerid, masterid, workerinfo)
Parameters:
  • workerid (integer) – the ID of the worker

  • masterid (integer) – the ID of the master to which it connected

  • workerinfo (dict) – the new worker information dictionary

Returns:

Deferred

Record the given worker as attached to the given master, and update its cached worker information. The supplied information completely replaces any existing information.

workerDisconnected(workerid, masterid)
Parameters:
  • workerid (integer) – the ID of the worker

  • masterid (integer) – the ID of the master to which it connected

Returns:

Deferred

Record the given worker as no longer attached to the given master.

workerConfigured(workerid, masterid, builderids)
Parameters:
  • workerid (integer) – the ID of the worker

  • masterid (integer) – the ID of the master to which it configured

  • builderids (list of integer) – the ID of the builders to which it is configured

Returns:

Deferred

Record the given worker as being configured on the given master and for given builders. This method will also remove any other builder that were configured previously for same (worker, master) combination.

deconfigureAllWorkersForMaster(masterid)
Parameters:

masterid (integer) – the ID of the master to which it configured

Returns:

Deferred

Unregister all the workers configured to a master for given builders. This shall happen when master is disabled or before reconfiguration.

setWorkerState(workerid, paused, graceful)
Parameters:
  • workerid (integer) – the ID of the worker whose state is being changed

  • paused (integer) – the paused state

  • graceful (integer) – the graceful state

Returns:

Deferred

Change the state of a worker (see definition of states above in worker dict description).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文