-
Notifications
You must be signed in to change notification settings - Fork 63
Added start time for supporting restarts for fixed rate schedules #476
Conversation
can you add a tracking issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw is this ready for review?
7c91a91
to
6dcbad5
Compare
@katrogan yes it ready for review |
Codecov Report
@@ Coverage Diff @@
## master #476 +/- ##
==========================================
+ Coverage 58.64% 59.93% +1.29%
==========================================
Files 172 168 -4
Lines 16365 13171 -3194
==========================================
- Hits 9597 7894 -1703
+ Misses 5920 4440 -1480
+ Partials 848 837 -11
Flags with carried forward coverage won't be shown. Click here to find out more. |
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: Prafulla Mahindrakar <[email protected]>
Signed-off-by: pmahindrakar-oss <[email protected]>
305978d
to
3db1d5f
Compare
Signed-off-by: pmahindrakar-oss <[email protected]>
scheduler/core/gocron_scheduler.go
Outdated
@@ -271,7 +271,11 @@ func (g *GoCronScheduler) AddFixedIntervalJob(ctx context.Context, job *GoCronJo | |||
var jobFunc cron.TimedFuncJob | |||
jobFunc = job.Run | |||
|
|||
entryID := g.cron.ScheduleTimedJob(cron.ConstantDelaySchedule{Delay: d}, jobFunc) | |||
var lastExecTime time.Time | |||
if job.lastTime != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should this field name change to job.lastExecTime too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this would mean maintaining backward compat. I will clean this up when i next make change to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought, the JobStore will get loaded again after new version, so it will start using the new field after the restart, so we don't have to worry about backward compat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, can you verify that there are indeed no problems on restart locally?
tests/scheduler_test.go
Outdated
} | ||
}) | ||
|
||
t.Run("without schedule time", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry if I'm being dense - can you point out how this test differs than the one above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check L62 & L90,
The last Parameter to schedulerJob is different.
And also the assertion in timedFuncWithSchedule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored the test to remove redundant code which makes this test clearer
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: pmahindrakar-oss <[email protected]>
Signed-off-by: eduardo apolinario <[email protected]>
…yteorg#476) * Added race skip check Signed-off-by: Prafulla Mahindrakar <[email protected]> * lint Signed-off-by: Prafulla Mahindrakar <[email protected]> * Fixed unit tests Signed-off-by: pmahindrakar-oss <[email protected]> * Moved to integration test Signed-off-by: pmahindrakar-oss <[email protected]> * refactored integration test Signed-off-by: pmahindrakar-oss <[email protected]> * nit : rename to lastTime Signed-off-by: pmahindrakar-oss <[email protected]> * nit : revert Signed-off-by: pmahindrakar-oss <[email protected]> * lastTime -> lastExecTime Signed-off-by: pmahindrakar-oss <[email protected]> * integration test tag Signed-off-by: pmahindrakar-oss <[email protected]> --------- Signed-off-by: Prafulla Mahindrakar <[email protected]> Signed-off-by: pmahindrakar-oss <[email protected]> Signed-off-by: eduardo apolinario <[email protected]> Co-authored-by: eduardo apolinario <[email protected]> Signed-off-by: TungHoang <[email protected]>
* Added race skip check Signed-off-by: Prafulla Mahindrakar <[email protected]> * lint Signed-off-by: Prafulla Mahindrakar <[email protected]> * Fixed unit tests Signed-off-by: pmahindrakar-oss <[email protected]> * Moved to integration test Signed-off-by: pmahindrakar-oss <[email protected]> * refactored integration test Signed-off-by: pmahindrakar-oss <[email protected]> * nit : rename to lastTime Signed-off-by: pmahindrakar-oss <[email protected]> * nit : revert Signed-off-by: pmahindrakar-oss <[email protected]> * lastTime -> lastExecTime Signed-off-by: pmahindrakar-oss <[email protected]> * integration test tag Signed-off-by: pmahindrakar-oss <[email protected]> --------- Signed-off-by: Prafulla Mahindrakar <[email protected]> Signed-off-by: pmahindrakar-oss <[email protected]> Signed-off-by: eduardo apolinario <[email protected]> Co-authored-by: eduardo apolinario <[email protected]>
Signed-off-by: Prafulla Mahindrakar [email protected]
TL;DR
Testing Done:
Type
Are all requirements met?
Complete description
How did you fix the bug, make the feature etc. Link to any design docs etc
Tracking Issue
Remove the 'fixes' keyword if there will be multiple PRs to fix the linked issue
fixes flyteorg/flyte#2885
Follow-up issue