[Run Service] Fix CreateRun response fields and fill missing default …#7058
Open
WangWang0226 wants to merge 1 commit intoflyteorg:v2from
Open
[Run Service] Fix CreateRun response fields and fill missing default …#7058WangWang0226 wants to merge 1 commit intoflyteorg:v2from
WangWang0226 wants to merge 1 commit intoflyteorg:v2from
Conversation
…inputs Signed-off-by: WangWang0226 <[email protected]>
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.
Tracking issue
#6972
Why are the changes needed?
This PR addresses gaps in the
CreateRunworkflow to ensure consistent behavior and a complete API response.Specifically:
Missing default input handling
When users do not provide certain inputs,
CreateRunshould populate them using the task’sdefault_inputs, without overriding user-provided values.Incomplete response fields
The
CreateRunresponse previously lacked essential fields required by downstream consumers, such as metadata and execution status.What changes were proposed in this pull request?
1. Add
fillDefaultInputstoCreateRunFile:
runs/service/run_service.goIntroduced
s.fillDefaultInputs(ctx, req.Msg)before persisting inputs.Logic:
taskSpec.default_inputsproto.Cloneto avoid shared pointer side effects2. Add
getCreateRunTaskSpecFile:
runs/service/run_service.goSupports both task specification sources:
CreateRunRequest_TaskSpec: use inline spec directlyCreateRunRequest_TaskId: fetch fromTaskRepo.GetTaskandproto.UnmarshalThis ensures consistent handling regardless of how the task is provided.
3. Introduce a dedicated response builder for
CreateRunFile:
runs/service/run_service.goCreateRunnow returns:buildCreateRunResponse(run)The response includes:
run.action.metadatarun.action.status.phaserun.action.status.start_timerun.action.status.attempts = 1run.action.status.cache_status = CACHE_DISABLEDFields intentionally excluded at creation time:
end_timeduration_msDesign decision: Not passing
actionIDintobuildCreateRunResponseInstead of passing
actionID, it is reconstructed from the persistedrun.Rationale:
Single source of truth
Ensures the response is fully derived from the persisted state, avoiding inconsistencies.
Better testability
The function depends only on
run, making it easier to test in isolation.Reduced coupling
Avoids passing intermediate variables across layers solely for response construction.
Why not modify
convertRunToProto?convertRunToProtois shared byListRunsandWatchRuns.To avoid unintended side effects or breaking existing contracts, this PR isolates
CreateRunresponse logic in a separate builder (buildCreateRunResponse).How was this patch tested?
Unit Tests (Added)
File:
runs/service/run_service_test.goTestFillDefaultInputsTestCreateRunResponseIncludesMetadataAndStatusVerifies presence of
metadataandstatusVerifies:
phasestartTimeattemptscacheStatusTest Results
Local Integration Test Steps
CreateRunKnown Observations
cacheStatusis set toCACHE_DISABLED (enum=0), it may be omitted in proto3 JSON output.Labels
Setup process
See local integration steps above.
Screenshots
N/A (backend/API change)
Check all the applicable boxes
Related PRs
N/A
Docs link
N/A
main