<#6825 Fix: Add timestamps to task creation> Pull ...
# flyte-github
a
#6825 Fix: Add timestamps to task creation Pull request opened by yuhuan130 ## Tracking issue Related to #6813 (Initial task service implementation) ## Why are the changes needed? Timestamps (
created_at
,
updated_at
) are not being populated in the
tasks
table, which causes: 1.
ListTasks
sorting by
created_at
to be ineffective (line 158 in
impl/task.go
) 2. API responses to show incorrect
deployedAt: "0001-01-01T00:00:00Z"
instead of actual deployment time 3. No audit trail for when tasks were created or last updated ## What changes were proposed in this pull request? Added timestamp handling to the
CreateTask
function in `runs/repository/impl/task.go`: 1. Added columns to INSERT statement:
created_at
and
updated_at
2. Set values: Both timestamps use
time.Now()
when creating new tasks 3. ON CONFLICT behavior: When a task is re-deployed (same version), only
updated_at
is refreshed while
created_at
preserves the original creation time 4. Import added: Added
time
package import Files changed: •
runs/repository/impl/task.go
(lines ~3, 35, 47, 64-65) ## How was this patch tested? ### Manual testing with local SQLite database: Test 1: Create new task # Started runs service locally make run # Created a task using test script ./runs/tests/scripts/create_task.sh # Verified in database sqlite3 runs/runs.db "SELECT name, version, created_at, updated_at FROM tasks" [(base) yuhuan@yuhuan flyte runstestsscriptslist_tasks sh](https://private-user-images.githubusercontent.com/115371007/530629821-914afee4-3579-4801-a7a1-65afc5af0023.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjcwODQ5NTcsIm5iZiI6MTc2NzA4NDY1NywicGF0aCI6Ii8xMTUzNzEwMDcvNTMwNjI5ODIxLTkxNGFmZWU0LTM1NzktNDgwMS1hN2ExLTY1YWZjNWFmMDAyMy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUxMjMwJTJGdXMt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