buildgrid 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -311,7 +311,7 @@ def _curl_multi_run(
311
311
  m.remove_handle(c)
312
312
  curl_handles.clear()
313
313
 
314
- if retry_objects and attempt < S3_MAX_RETRIES:
314
+ if retry_objects:
315
315
  # Wait between attempts with truncated exponential backoff with jitter
316
316
  exp_backoff = 2 ** (attempt - 1)
317
317
  exp_backoff_with_jitter = random.random() * exp_backoff
@@ -1812,6 +1812,7 @@ class Scheduler:
1812
1812
  instance_name=instance_name,
1813
1813
  expiry_time=datetime.utcnow() + timedelta(seconds=self.bot_session_keepalive_timeout),
1814
1814
  capacity=bot_capacity,
1815
+ max_capacity=bot_capacity,
1815
1816
  cohort=bot_cohort,
1816
1817
  )
1817
1818
  )
@@ -1906,6 +1907,7 @@ class Scheduler:
1906
1907
 
1907
1908
  def _publish_job_duration(
1908
1909
  self,
1910
+ instance_name: str,
1909
1911
  start: Timestamp | None,
1910
1912
  end: Timestamp | None,
1911
1913
  state: str,
@@ -1919,6 +1921,7 @@ class Scheduler:
1919
1921
  publish_timer_metric(
1920
1922
  METRIC.JOB.DURATION,
1921
1923
  end.ToDatetime() - start.ToDatetime(), # type: ignore[union-attr]
1924
+ instanceName=instance_name,
1922
1925
  state=state,
1923
1926
  propertyLabel=property_label,
1924
1927
  schedulerName=assigner_name or "none",
@@ -1964,6 +1967,7 @@ class Scheduler:
1964
1967
  now_timestamp = Timestamp()
1965
1968
  now_timestamp.FromDatetime(datetime.utcnow())
1966
1969
  self._publish_job_duration(
1970
+ next_job.instance_name,
1967
1971
  start_timestamp,
1968
1972
  now_timestamp,
1969
1973
  "Queued",
@@ -2226,6 +2230,7 @@ class Scheduler:
2226
2230
  now_timestamp = Timestamp()
2227
2231
  now_timestamp.FromDatetime(datetime.utcnow())
2228
2232
  self._publish_job_duration(
2233
+ job.instance_name,
2229
2234
  start_timestamp,
2230
2235
  now_timestamp,
2231
2236
  "Queued",
@@ -2526,7 +2531,12 @@ class Scheduler:
2526
2531
  )
2527
2532
  )
2528
2533
  self._publish_execution_stats(
2529
- session, job.name, action_result.execution_metadata, job.property_label, job.assigner_name
2534
+ session,
2535
+ job.name,
2536
+ job.instance_name,
2537
+ action_result.execution_metadata,
2538
+ job.property_label,
2539
+ job.assigner_name,
2530
2540
  )
2531
2541
 
2532
2542
  def get_bot_status_metrics(self) -> BotMetrics:
@@ -2683,17 +2693,21 @@ class Scheduler:
2683
2693
  def publish_execution_stats(
2684
2694
  self,
2685
2695
  job_name: str,
2696
+ instance_name: str,
2686
2697
  execution_metadata: ExecutedActionMetadata,
2687
2698
  property_label: str = "unknown",
2688
2699
  assigner_name: str | None = None,
2689
2700
  ) -> None:
2690
2701
  with self._sql_ro.session(expire_on_commit=False) as session:
2691
- self._publish_execution_stats(session, job_name, execution_metadata, property_label, assigner_name)
2702
+ self._publish_execution_stats(
2703
+ session, job_name, instance_name, execution_metadata, property_label, assigner_name
2704
+ )
2692
2705
 
2693
2706
  def _publish_execution_stats(
2694
2707
  self,
2695
2708
  session: Session,
2696
2709
  job_name: str,
2710
+ instance_name: str,
2697
2711
  execution_metadata: ExecutedActionMetadata,
2698
2712
  property_label: str,
2699
2713
  assigner_name: str | None,
@@ -2709,12 +2723,18 @@ class Scheduler:
2709
2723
  upload_start = execution_metadata.output_upload_start_timestamp
2710
2724
  upload_completed = execution_metadata.output_upload_completed_timestamp
2711
2725
 
2712
- self._publish_job_duration(queued, worker_completed, "Total", property_label, assigner_name)
2726
+ self._publish_job_duration(instance_name, queued, worker_completed, "Total", property_label, assigner_name)
2713
2727
  # The Queued time is missing here as it's posted as soon as worker has accepted the job.
2714
- self._publish_job_duration(worker_start, worker_completed, "Worker", property_label, assigner_name)
2715
- self._publish_job_duration(fetch_start, fetch_completed, "Fetch", property_label, assigner_name)
2716
- self._publish_job_duration(execution_start, execution_completed, "Execution", property_label, assigner_name)
2717
- self._publish_job_duration(upload_start, upload_completed, "Upload", property_label, assigner_name)
2728
+ self._publish_job_duration(
2729
+ instance_name, worker_start, worker_completed, "Worker", property_label, assigner_name
2730
+ )
2731
+ self._publish_job_duration(instance_name, fetch_start, fetch_completed, "Fetch", property_label, assigner_name)
2732
+ self._publish_job_duration(
2733
+ instance_name, execution_start, execution_completed, "Execution", property_label, assigner_name
2734
+ )
2735
+ self._publish_job_duration(
2736
+ instance_name, upload_start, upload_completed, "Upload", property_label, assigner_name
2737
+ )
2718
2738
 
2719
2739
  if self.metering_client is None or len(execution_metadata.auxiliary_metadata) == 0:
2720
2740
  return
@@ -84,7 +84,7 @@ REQUEST_METADATA_TOOL_NAME = "buildgrid"
84
84
  REQUEST_METADATA_TOOL_VERSION = __version__
85
85
 
86
86
  S3_USERAGENT_NAME = f"{REQUEST_METADATA_TOOL_NAME}/{REQUEST_METADATA_TOOL_VERSION}"
87
- S3_MAX_RETRIES = 4
87
+ S3_MAX_RETRIES = 5
88
88
  S3_MAX_UPLOAD_SIZE = 8 * 1024 * 1024
89
89
  S3_TIMEOUT_CONNECT = 120
90
90
  S3_TIMEOUT_READ = 120
@@ -0,0 +1,47 @@
1
+ # Copyright (C) 2025 Bloomberg LP
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # <http://www.apache.org/licenses/LICENSE-2.0>
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Add immutable jobs.max_capacity column
16
+
17
+ Revision ID: 8f7f43e4a833
18
+ Revises: 85096c931383
19
+ Create Date: 2025-12-09 14:03:01.907296
20
+
21
+ """
22
+
23
+ import sqlalchemy as sa
24
+ from alembic import op
25
+
26
+
27
+ # revision identifiers, used by Alembic.
28
+ revision = "8f7f43e4a833"
29
+ down_revision = "85096c931383"
30
+ branch_labels = None
31
+ depends_on = None
32
+
33
+
34
+ def upgrade() -> None:
35
+ # ### commands auto generated by Alembic - please adjust! ###
36
+ with op.batch_alter_table("bots", schema=None) as batch_op:
37
+ batch_op.add_column(sa.Column("max_capacity", sa.Integer(), server_default=sa.text("1"), nullable=False))
38
+
39
+ # ### end Alembic commands ###
40
+
41
+
42
+ def downgrade() -> None:
43
+ # ### commands auto generated by Alembic - please adjust! ###
44
+ with op.batch_alter_table("bots", schema=None) as batch_op:
45
+ batch_op.drop_column("max_capacity")
46
+
47
+ # ### end Alembic commands ###
@@ -277,6 +277,7 @@ class BotEntry(Base):
277
277
  name: Mapped[str] = mapped_column(primary_key=True)
278
278
  bot_id: Mapped[str] = mapped_column(index=True)
279
279
  instance_name: Mapped[str] = mapped_column(index=True)
280
+ max_capacity: Mapped[int] = mapped_column(server_default=text("1"))
280
281
 
281
282
  # Scheduling state
282
283
  bot_status: Mapped[int]
@@ -13,4 +13,4 @@
13
13
  # limitations under the License.
14
14
 
15
15
 
16
- __version__ = "0.3.1"
16
+ __version__ = "0.3.3"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: buildgrid
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: A remote execution service
5
5
  License: Apache License, Version 2.0
6
6
  Project-URL: Homepage, https://buildgrid.build
@@ -205,10 +205,10 @@ buildgrid/server/monitoring.py,sha256=Ic1qKWfvlmcQOXLN3fVq6Ya1Co1lEU_2aHeXXof2Bf
205
205
  buildgrid/server/sentry.py,sha256=U5i3x6_zuQlUKoscjDkZCz35TJ-zaNvwlFyjowEEoLk,1471
206
206
  buildgrid/server/server.py,sha256=l-UxfEB6IJEEAzXHbXtIklwjiM18tTMPxI3uB7IvzGQ,29438
207
207
  buildgrid/server/servicer.py,sha256=oqU9MaSxxHTDmSxobFTo9YmJctaUCklE2Dj-vfYWKkc,6542
208
- buildgrid/server/settings.py,sha256=Iy4eS9Putr5GroIVqYNeTcRY7gbvq29wgQoMDQgPJtA,5604
208
+ buildgrid/server/settings.py,sha256=I1UK-g4_GwkX0nGC3hdGS3Cc0Rh1HTYDv2aHU2sq_eU,5604
209
209
  buildgrid/server/threading.py,sha256=4QKQYev2KoO2Q-S_OyaoR9qpWyDTVzGMWVe9o2a1yIU,4743
210
210
  buildgrid/server/types.py,sha256=xG3bx64pbWMuEwXLuI0o8c2unt2rU2C4zsmUfmMT12c,1323
211
- buildgrid/server/version.py,sha256=n9eZStzsUHVKCm33O5kD4RgMgRgIUVgOkmGO0lowsqw,603
211
+ buildgrid/server/version.py,sha256=ZFnZSeeeNvUxJJyB2m9gdtWL-3UIBuVI7L2U-mwR2NU,603
212
212
  buildgrid/server/actioncache/__init__.py,sha256=g9lb8Sn7NY5KOjkMr9GQoJovCVDEg_Fxz_EhdDbhP1I,579
213
213
  buildgrid/server/actioncache/instance.py,sha256=UCR7ZGkv4fJOXjeIILMAdTSFWcGgBSYlBg8fMaPJpaI,3139
214
214
  buildgrid/server/actioncache/service.py,sha256=WcikJAzFYOYX-tgiOfGGcOnPoubrCd4yP-EhKCHEW0c,2021
@@ -326,16 +326,16 @@ buildgrid/server/quota/service.py,sha256=YFV3zedluSCehFF32sBa_AWPWYS8w_bxHHIbGNv
326
326
  buildgrid/server/redis/__init__.py,sha256=avyRxG9BSFd76mCHnGYInDDTqyqDn0UlhOuFzAkPQSs,579
327
327
  buildgrid/server/redis/provider.py,sha256=oeN69kC0HGLwb-9e2pSOSUleSauUjKkR9NgBbDOfpW4,6270
328
328
  buildgrid/server/s3/__init__.py,sha256=zbeeRP9BEeDzR-Mx2Ip6SUr49J8eeXsuREgljJTrHkk,579
329
- buildgrid/server/s3/s3utils.py,sha256=_LzHob5ni5mvqeCPk4n_TozrQ3PUIaNx6hJfaS7PUfk,21697
329
+ buildgrid/server/s3/s3utils.py,sha256=AcOeUY-KkfwH1ydbulNsxYp3TMmnZj479d9Ceu8TWok,21668
330
330
  buildgrid/server/scheduler/__init__.py,sha256=arCg8LWFATeX1tj-s0keVYP8p3wwrrUlCV980bxcSII,1084
331
331
  buildgrid/server/scheduler/assigner.py,sha256=wHPAhyiQxYABZJXaUc2g5yFzM78Z0U5nvGV3X9h5pCM,10512
332
332
  buildgrid/server/scheduler/cohorts.py,sha256=L_5YZRiVOwPPGStfqnnQXknO5Ja-SC0vq0xjw4XgP-I,1426
333
333
  buildgrid/server/scheduler/events.py,sha256=cM7Z7Htr2pYKhltJxfg1YRo0q524yZaGm8yXvRehivk,1453
334
- buildgrid/server/scheduler/impl.py,sha256=jqwf4HU6otf0XLpq0hFUC8JhOgyFKPKYd2-x23biz1M,135712
334
+ buildgrid/server/scheduler/impl.py,sha256=BT5JIdh7B6-pw1OHxnhJjZgQ1sM3T1UxakXoc6ppBxs,136236
335
335
  buildgrid/server/scheduler/notifier.py,sha256=22ZsKwyf2oQirAjrwROkvgvr4C_TMUNyhOmtro4uM4I,7121
336
336
  buildgrid/server/scheduler/properties.py,sha256=2GydX8KUy9MFv1_JznIkGfWE_wOS0m_XapSv6Gp4pCM,11260
337
337
  buildgrid/server/sql/__init__.py,sha256=zbeeRP9BEeDzR-Mx2Ip6SUr49J8eeXsuREgljJTrHkk,579
338
- buildgrid/server/sql/models.py,sha256=jAuNLLvdlBWf7uZWlPLMSC1dTWHYlqlk9Pn5A04rQcg,14374
338
+ buildgrid/server/sql/models.py,sha256=EN7zle9sxSZ_nrv-w1ewXLmsTl1x3q-opwtJ2VPA4G4,14446
339
339
  buildgrid/server/sql/provider.py,sha256=CXOpjcUY-InwmGnZTpCd4_ziOdROiDY34_SRpqsBwwk,18965
340
340
  buildgrid/server/sql/utils.py,sha256=j76Z_qtGawz6O7vO4-zgCzBV4ylhKszcd_6iY0gV4W4,16470
341
341
  buildgrid/server/sql/alembic/README,sha256=MVlc9TYmr57RbhXET6QxgyCcwWP7w-vLkEsirENqiIQ,38
@@ -351,6 +351,7 @@ buildgrid/server/sql/alembic/versions/55fcf6c874d3_remove_request_metadata_from_
351
351
  buildgrid/server/sql/alembic/versions/5745d1f0e537_drop_unused_indexes_and_create_.py,sha256=OjQrx8aTNSrwshVDozydcJzJYWmmJLSoGdnSlSMBcGM,2497
352
352
  buildgrid/server/sql/alembic/versions/5b90ed0e9d0b_drop_ix_jobs_worker_name_stage.py,sha256=keiHTEhWpor13V4SCW_LqfgEsMn4E8JL_f16JlUhl1U,1585
353
353
  buildgrid/server/sql/alembic/versions/85096c931383_drop_ix_jobs_stage_property_label_and_.py,sha256=9r4HEYorA5J4kFarDjdfoJZ-g1HGyEdEIZoVIxlSwAg,1926
354
+ buildgrid/server/sql/alembic/versions/8f7f43e4a833_add_immutable_jobs_max_capacity_column.py,sha256=sUrFN1c4yr82PXeUWaxdJb3nSG_BzXgJH94hLVjVeRw,1446
354
355
  buildgrid/server/sql/alembic/versions/8fd7118e215e_add_instanced_job_scheduling_index.py,sha256=U7gmqLlSdl3lsWN2LJYcJHFsIzufvzbHskdmSt5h-Xk,1737
355
356
  buildgrid/server/sql/alembic/versions/90bd87d052a0_add_an_audit_table_for_job_state_changes.py,sha256=NrD_D4yjEMQL1cvRZAymxMtU1eyGMkh4OvCsc5y-cXw,1622
356
357
  buildgrid/server/sql/alembic/versions/910398062924_add_property_labels_table.py,sha256=2gJlJHMX3zx7uV4bVxCyRXC4ZYsQLdu9nMStWmpx9VM,1755
@@ -365,9 +366,9 @@ buildgrid/server/utils/async_lru_cache.py,sha256=iLKeRPoZtZb1wC5AtcyQm8Wt0Bx-KZm
365
366
  buildgrid/server/utils/bots.py,sha256=c8hn7tbCecru-m2wicRmtKU5v5rSZPGlk97Yc6eUHgQ,1729
366
367
  buildgrid/server/utils/cancellation.py,sha256=pNETzKNoXg0AsXOXKCcLWlFl7SVKdkKinlqWl7MesRA,1703
367
368
  buildgrid/server/utils/digests.py,sha256=YNrWeHdbNp7OVTcsInjs30C33z_t9GQ_noMd14bpqPQ,2424
368
- buildgrid-0.3.1.dist-info/licenses/LICENSE,sha256=swa3Vs7GgALaG9p-e05M-WLkhd_U9QknacNkyVZ85xA,11338
369
- buildgrid-0.3.1.dist-info/METADATA,sha256=_Tt0d76-FzhNXCN5Zm7GNYMl0GgVS3br_ok2uQABmgA,7086
370
- buildgrid-0.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
371
- buildgrid-0.3.1.dist-info/entry_points.txt,sha256=uyFAXiR9d6EDfSA5vWT8xskz6xalt4PdTuRruT6Q8rk,49
372
- buildgrid-0.3.1.dist-info/top_level.txt,sha256=T6TYhI_k6NTm2871tIxGCyBIqzlKxylgF9KDLU0Hi7o,10
373
- buildgrid-0.3.1.dist-info/RECORD,,
369
+ buildgrid-0.3.3.dist-info/licenses/LICENSE,sha256=swa3Vs7GgALaG9p-e05M-WLkhd_U9QknacNkyVZ85xA,11338
370
+ buildgrid-0.3.3.dist-info/METADATA,sha256=dshu6eNHOz_JPLV3tM3gGitvI9BaGiWpgTWvv2sqjb0,7086
371
+ buildgrid-0.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
372
+ buildgrid-0.3.3.dist-info/entry_points.txt,sha256=uyFAXiR9d6EDfSA5vWT8xskz6xalt4PdTuRruT6Q8rk,49
373
+ buildgrid-0.3.3.dist-info/top_level.txt,sha256=T6TYhI_k6NTm2871tIxGCyBIqzlKxylgF9KDLU0Hi7o,10
374
+ buildgrid-0.3.3.dist-info/RECORD,,