Remove the transitional Job.compute_profile string field (step 1) - #2466
Draft
Elena Peña Tapia (ElePT) wants to merge 1 commit into
Draft
Remove the transitional Job.compute_profile string field (step 1)#2466Elena Peña Tapia (ElePT) wants to merge 1 commit into
Elena Peña Tapia (ElePT) wants to merge 1 commit into
Conversation
Job.compute_profile (string) was a stopgap superseded by compute_profile_fk (FK -> ComputeProfile), the source of truth for the profile a job ran on. The two were written together and always agreed at creation; this retires the string. Step 1 of a two-step removal (mirrors Program.default_compute_profile, #2420 -> #2421): repoint readers to the FK via a new null-safe Job.compute_profile_id property, then remove the field from Django's model STATE only. The DB column is left in place so the previous release stays deployable; the real DROP COLUMN ships in a later PR once no field-declaring release can deploy. - Readers repointed to compute_profile_id: fleet name + resource limits (fleets_runner), admin job timeline (+ select_related to avoid an N+1). - Writers: run path and filler-jobs path no longer write the string (both already set compute_profile_fk). - API: compute_profile dropped from job serializers; compute_profile_fk (already present) carries the profile. Client Job loses its compute_profile attribute. - Admin: field removed from the JobAdmin Fleets fieldset. - Migration 0064: state-only RemoveField wrapped in SeparateDatabaseAndState. BLOCKED on the billing team: the Kafka usage-event path (_build_classical_metric_type in kafka_event_streams_client.py) still reads job.compute_profile and is owned by another team, so it is deliberately left untouched here. They must repoint it to job.compute_profile_fk.compute_profile_id before this removal can merge; until then the model state change would break their event build. Out of scope: the DROP COLUMN (step 2) and the deprecated compute_profile run input kwarg (use function_size).
Elena Peña Tapia (ElePT)
force-pushed
the
remove-job-compute-profile-string
branch
from
September 4, 2026 12:15
a9583e3 to
ad04f50
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
BLOCKED — needs a change from the billing team before this can merge.
The Kafka usage-event path builds the classical metric type from
job.compute_profile(the string this PR removes):_build_classical_metric_typeingateway/core/ibm_cloud/event_streams/kafka_event_streams_client.py.That file is owned by another team, so this PR deliberately does not touch it.
Before this removal can merge, the billing team needs to repoint that method:
Job.compute_profile_id(added here) returnscompute_profile_fk.compute_profile_id(or
None), which equals the old string wherever it was set — so the emittedmetric type is unchanged. Until that lands, merging this PR would raise
AttributeErrorwhen a usage event is built. The corresponding test(
tests/core/services/ibm_cloud/event_streams/test_event_streams_client.py) isalso left for them to update alongside their change.
Summary
Removes the transitional
Job.compute_profilestring field. It was introducedalongside the t-shirt sizes work as a stopgap and superseded by
Job.compute_profile_fk(FK →
ComputeProfile), which is the source of truth for the profile a job ran on. The twowere written together on every run and always agreed at creation; this PR retires the string.
This is Step 1 of a two-step removal that keeps every deployed release safe to roll back —
the same pattern used to drop
Program.default_compute_profile(#2420 → #2421):model state only — the
api_job.compute_profilecolumn is left in the database, sothe previous release (whose
Jobmodel still declares the field and lists it in everySELECT) stays deployable.DROP COLUMN, once no release that still declaresthe field can be deployed.
What changed
Readers repointed to the FK. A new null-safe
Job.compute_profile_idproperty returnscompute_profile_fk.compute_profile_id(orNonefor Ray / historical rows), preserving theexisting
… or settings.DEFAULT_COMPUTE_PROFILEfallback everywhere. Repointed:core/services/runners/fleets_runner.pyapi/domain/job_timeline.py(+select_related("compute_profile_fk")on the two timeline querysets in
api/admin.pyto avoid an N+1)The billing/Kafka reader is intentionally not repointed here — see the blocked note above.
Writers. The string is no longer written on the run path (
api/use_cases/programs/run.py)or the filler-jobs path (
scheduler/tasks/balance_filler_jobs.py); both already setcompute_profile_fk.API shape.
compute_profile(string) is dropped from the job serializers;compute_profile_fk(nested
ComputeProfileSerializer, already present on the list/retrieve responses) carries theprofile. Client
Jobloses itscompute_profileattribute.Admin. The
compute_profilefield is removed from theJobAdmin"Fleets" fieldset(
compute_profile_fkstays).Migration.
0064_remove_job_compute_profile_state.py— a state-onlyRemoveFieldwrapped inSeparateDatabaseAndState(emptydatabase_operations), mirroring0057. Its comment alsorecords the billing-team dependency above.
Out of scope
DROP COLUMN(Step 2, follow-up PR).compute_profilerun input kwarg onfunction.run(...)/ the runInputSerializer— a separate surface, retired separately.function_sizeis the replacement.Notes
RunnerConfig.compute_profileis set tocompute_profile_fk.compute_profile_idin every branch of
_get_runner_config, and Ray leaves both null — so string and FK agreewherever the FK is non-null.
Program.default_compute_profileprecedent (Keep the default_compute_profile column so a previous release can still be deployed #2420/Drop theapi_program.default_compute_profilecolumn #2421).Opened as draft for review.