fix(spark): populate timestamp fields in log template input#7271
Open
cmditch wants to merge 1 commit intoflyteorg:masterfrom
Open
fix(spark): populate timestamp fields in log template input#7271cmditch wants to merge 1 commit intoflyteorg:masterfrom
cmditch wants to merge 1 commit intoflyteorg:masterfrom
Conversation
6021c65 to
02f75fb
Compare
The Spark plugin constructs tasklog.Input without setting any of the
timestamp fields (PodUnixStartTime, PodUnixFinishTime, and their
RFC3339 equivalents). This causes log template URIs that reference
{{ .podUnixStartTime }} to render as 0, making it impossible to
construct time-bounded log links for external logging services like
Grafana Loki or Kibana.
The standard K8s plugin and kfoperators already populate these fields
from the resource's CreationTimestamp. This change does the same for
all four tasklog.Input structs in getEventInfoForSpark.
Fixes flyteorg#6328
Signed-off-by: Coury Ditch <cmditch@gmail.com>
02f75fb to
ff2a24a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7271 +/- ##
==========================================
+ Coverage 56.95% 56.97% +0.01%
==========================================
Files 931 931
Lines 58250 58268 +18
==========================================
+ Hits 33179 33197 +18
Misses 22017 22017
Partials 3054 3054
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pingsutw
reviewed
Apr 30, 2026
| taskExecID := pluginContext.TaskExecutionMetadata().GetTaskExecutionID() | ||
|
|
||
| startTime := sj.CreationTimestamp.Unix() | ||
| finishTime := time.Now().Unix() |
Member
There was a problem hiding this comment.
Does spark job crd have finish time? Also, we should only set it when job is completed
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.
Summary
The Spark plugin's
getEventInfoForSparkconstructstasklog.Inputwithout populating any timestamp fields (PodUnixStartTime,PodUnixFinishTime,PodRFC3339StartTime,PodRFC3339FinishTime). This causes log template URIs referencing{{ .podUnixStartTime }}to render as0, making it impossible to construct time-bounded log links for external logging services like Grafana Loki or Kibana.The standard K8s plugin (
logging_utils.go) and kfoperators (common_operator.go) already populate these fields from the resource'sCreationTimestamp. This change applies the same pattern to all fourtasklog.Inputstructs ingetEventInfoForSpark.Changes
startTimefromsj.CreationTimestamp.Unix()andfinishTimefromtime.Now().Unix()at the top ofgetEventInfoForSparkPodUnixStartTime,PodUnixFinishTime,PodRFC3339StartTime, andPodRFC3339FinishTimein all fourtasklog.Inputstructs (Driver, User, System, and All-User logs)TestGetEventInfoTimestampstest that verifies timestamp template variables are correctly populated in generated log URIsTesting
{{ .podUnixStartTime }}renders the actual creation timestamp rather than0{{ .podUnixStartTime }}000for epoch-ms time rangesFixes #6328