返回介绍

3.8.5. Build data connector

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

Caution

Buildbot no longer supports Python 2.7 on the Buildbot master.

3.8.5. Build data connector

class buildbot.db.build_data.BuildDataConnectorComponent

This class handles build data. Build data is potentially large transient text data attached to the build that the steps can use for their operations. One of the use cases is to carry large amount of data from one step to another where storing that data on the worker is not feasible. This effectively forms a key-value store for each build. It is valid only until the build finishes and all reporters are done reporting the build result. After that the data may be removed from the database.

An instance of this class is available at master.db.build_data.

Builds are indexed by build_dataid and their contents represented as build_datadicts (build data dictionaries), with the following keys:

  • id (the build data ID, globally unique)

  • buildid (the ID of the build that the data is attached to)

  • name (the name of the data)

  • value (the value of the data. It must be an instance of bytes)

  • source (an string identifying the source of this value)

setBuildData(buildid, name, value, source)
Parameters:
  • buildid (integer) – build id to attach data to

  • name (unicode) – the name of the data

  • value (bytestr) – the value of the data as bytes.

Parma unicode source:

the source of the data

Returns:

Deferred

Adds or replaces build data attached to the build.

getBuildData(buildid, name)
Parameters:
  • buildid (integer) – build id retrieve data for

  • name (unicode) – the name of the data

Returns:

Build data dictionary as above or None, via Deferred

Get a single build data, in the format described above, specified by build and by name. Returns None if build has no data with such name.

getBuildDataNoValue(buildid, name)
Parameters:
  • buildid (integer) – build id retrieve data for

  • name (unicode) – the name of the data

Returns:

Build data dictionary as above or None, via Deferred

Get a single build data, in the format described above, specified by build and by name. The value field is omitted. Returns None if build has no data with such name.

getAllBuildDataNoValues(buildid, name=None)
Parameters:
  • buildid (integer) – build id retrieve data for

  • name (unicode) – the name of the data

Returns:

a list of build data dictionaries

Returns all data for a specific build. The values are not loaded. The returned values can be filtered by name

deleteOldBuildData(older_than_timestamp)
Parameters:

older_than_timestamp (integer) – the build data whose build’s complete_at is older than older_than_timestamp will be deleted.

Returns:

Deferred

Delete old build data (helper for the build_data_horizon policy). Old logs have their build data deleted from the database as they are only useful while build is running and shortly afterwards.

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

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

发布评论

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