buildgrid 0.2.52__py3-none-any.whl → 0.2.53__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.
- buildgrid/server/scheduler/impl.py +20 -11
- buildgrid/server/version.py +1 -1
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/METADATA +1 -1
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/RECORD +8 -8
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/WHEEL +0 -0
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/entry_points.txt +0 -0
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/licenses/LICENSE +0 -0
- {buildgrid-0.2.52.dist-info → buildgrid-0.2.53.dist-info}/top_level.txt +0 -0
|
@@ -1949,7 +1949,9 @@ class Scheduler:
|
|
|
1949
1949
|
)
|
|
1950
1950
|
|
|
1951
1951
|
@timed(METRIC.SCHEDULER.ASSIGNMENT_DURATION)
|
|
1952
|
-
def _fetch_job_for_bot(
|
|
1952
|
+
def _fetch_job_for_bot(
|
|
1953
|
+
self, session: Session, bot: BotEntry, usage_diffs: InstanceQuotaUsageDiffs, log_tags: Tags
|
|
1954
|
+
) -> JobEntry | None:
|
|
1953
1955
|
# Attempt to fetch a new job for a bot to work on.
|
|
1954
1956
|
# This can help if there are usually more jobs available than bots.
|
|
1955
1957
|
|
|
@@ -1959,15 +1961,22 @@ class Scheduler:
|
|
|
1959
1961
|
if bot.instance_name != "*":
|
|
1960
1962
|
job_statement = job_statement.where(self._job_in_instance_pool())
|
|
1961
1963
|
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1964
|
+
if bot.cohort:
|
|
1965
|
+
# Prioritize instance where usage <= max_quota - bot.capacity
|
|
1966
|
+
# `- bot.capacity` to avoid over-assigning jobs to bots when nearing quota limits
|
|
1967
|
+
instances_query = select(InstanceQuota.instance_name).where(
|
|
1968
|
+
InstanceQuota.bot_cohort == bot.cohort,
|
|
1969
|
+
InstanceQuota.current_usage <= InstanceQuota.max_quota - bot.capacity,
|
|
1970
|
+
)
|
|
1971
|
+
instances: set[str] = set()
|
|
1972
|
+
instances.update(session.execute(instances_query).scalars().all())
|
|
1973
|
+
# Always allow scheduling more jobs of an instance if we're returning usage
|
|
1974
|
+
instances.update(
|
|
1975
|
+
{instance for (cohort, instance), diff in usage_diffs.items() if cohort == bot.cohort and diff < 0}
|
|
1976
|
+
)
|
|
1977
|
+
|
|
1978
|
+
if instances:
|
|
1979
|
+
job_statement = job_statement.where(JobEntry.instance_name.in_(instances))
|
|
1971
1980
|
|
|
1972
1981
|
if next_job := session.execute(job_statement).scalar_one_or_none():
|
|
1973
1982
|
log_tags["db.next_job_name"] = next_job.name
|
|
@@ -2321,7 +2330,7 @@ class Scheduler:
|
|
|
2321
2330
|
|
|
2322
2331
|
for _ in range(fetch_limit):
|
|
2323
2332
|
# Try to fill up the newly free capacity with new jobs.
|
|
2324
|
-
if new_job := self._fetch_job_for_bot(session, bot, log_tags):
|
|
2333
|
+
if new_job := self._fetch_job_for_bot(session, bot, usage_diffs, log_tags):
|
|
2325
2334
|
if bot.cohort:
|
|
2326
2335
|
usage_diffs[(bot.cohort, new_job.instance_name)] += 1
|
|
2327
2336
|
synchronized_leases.append(new_job.to_lease_proto())
|
buildgrid/server/version.py
CHANGED
|
@@ -208,7 +208,7 @@ buildgrid/server/servicer.py,sha256=oqU9MaSxxHTDmSxobFTo9YmJctaUCklE2Dj-vfYWKkc,
|
|
|
208
208
|
buildgrid/server/settings.py,sha256=Iy4eS9Putr5GroIVqYNeTcRY7gbvq29wgQoMDQgPJtA,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=
|
|
211
|
+
buildgrid/server/version.py,sha256=zv7pfyNMnfQiih7uFjY-_UFi2yhATpDRA43o8Nz28fo,604
|
|
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
|
|
@@ -334,7 +334,7 @@ buildgrid/server/scheduler/__init__.py,sha256=arCg8LWFATeX1tj-s0keVYP8p3wwrrUlCV
|
|
|
334
334
|
buildgrid/server/scheduler/assigner.py,sha256=wHPAhyiQxYABZJXaUc2g5yFzM78Z0U5nvGV3X9h5pCM,10512
|
|
335
335
|
buildgrid/server/scheduler/cohorts.py,sha256=L_5YZRiVOwPPGStfqnnQXknO5Ja-SC0vq0xjw4XgP-I,1426
|
|
336
336
|
buildgrid/server/scheduler/events.py,sha256=cM7Z7Htr2pYKhltJxfg1YRo0q524yZaGm8yXvRehivk,1453
|
|
337
|
-
buildgrid/server/scheduler/impl.py,sha256=
|
|
337
|
+
buildgrid/server/scheduler/impl.py,sha256=MR3Hp0hxuYTpFu0hnriin2GcY1xgri_HAok4EaeToow,137584
|
|
338
338
|
buildgrid/server/scheduler/notifier.py,sha256=uypoIXZowpAIsDQ728VCuFJ4MN2zJld1npnanCWHTrw,8854
|
|
339
339
|
buildgrid/server/scheduler/properties.py,sha256=2GydX8KUy9MFv1_JznIkGfWE_wOS0m_XapSv6Gp4pCM,11260
|
|
340
340
|
buildgrid/server/sql/__init__.py,sha256=zbeeRP9BEeDzR-Mx2Ip6SUr49J8eeXsuREgljJTrHkk,579
|
|
@@ -368,9 +368,9 @@ buildgrid/server/utils/async_lru_cache.py,sha256=iLKeRPoZtZb1wC5AtcyQm8Wt0Bx-KZm
|
|
|
368
368
|
buildgrid/server/utils/bots.py,sha256=c8hn7tbCecru-m2wicRmtKU5v5rSZPGlk97Yc6eUHgQ,1729
|
|
369
369
|
buildgrid/server/utils/cancellation.py,sha256=pNETzKNoXg0AsXOXKCcLWlFl7SVKdkKinlqWl7MesRA,1703
|
|
370
370
|
buildgrid/server/utils/digests.py,sha256=YNrWeHdbNp7OVTcsInjs30C33z_t9GQ_noMd14bpqPQ,2424
|
|
371
|
-
buildgrid-0.2.
|
|
372
|
-
buildgrid-0.2.
|
|
373
|
-
buildgrid-0.2.
|
|
374
|
-
buildgrid-0.2.
|
|
375
|
-
buildgrid-0.2.
|
|
376
|
-
buildgrid-0.2.
|
|
371
|
+
buildgrid-0.2.53.dist-info/licenses/LICENSE,sha256=swa3Vs7GgALaG9p-e05M-WLkhd_U9QknacNkyVZ85xA,11338
|
|
372
|
+
buildgrid-0.2.53.dist-info/METADATA,sha256=U9a7b52eyU6pWfE8PIMYE-Rl4TvhbC9d_Po0MEHnXG4,7040
|
|
373
|
+
buildgrid-0.2.53.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
374
|
+
buildgrid-0.2.53.dist-info/entry_points.txt,sha256=uyFAXiR9d6EDfSA5vWT8xskz6xalt4PdTuRruT6Q8rk,49
|
|
375
|
+
buildgrid-0.2.53.dist-info/top_level.txt,sha256=T6TYhI_k6NTm2871tIxGCyBIqzlKxylgF9KDLU0Hi7o,10
|
|
376
|
+
buildgrid-0.2.53.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|