-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Send overall (rather than per-stage) completion ratio to Studio #33
Conversation
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.
Cool!
clients/callback_client.go
Outdated
|
||
// Define the "base" numbers - e.g the overall ratio we start each stage at | ||
var TranscodeStatusPreparingBase float64 = 0.0 | ||
var TranscodeStatusPreparingTranscodingBase float64 = 0.4 |
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.
Should it be only "Transcoding"?
var TranscodeStatusPreparingTranscodingBase float64 = 0.4 | |
var TranscodeStatusTranscodingBase float64 = 0.4 |
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.
The "Base" was trying to signify that this is the lower limit / floor / whatever, open to suggestions for better names though. Maybe "Floor"?
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.
Just realised what you were actually pointing out 👓
clients/callback_client.go
Outdated
case TranscodeStatusPreparingCompleted: | ||
return TranscodeStatusPreparingTranscodingBase | ||
case TranscodeStatusTranscoding: | ||
return TranscodeStatusPreparingTranscodingBase + (currentStageCompletionRatio * (TranscodeStatusCompletedBase - TranscodeStatusPreparingTranscodingBase)) |
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.
Another way of implementing this, to have the more complex math only in 1 place, would be to have 2 vars "start" and "end" and force the currentStageCompletionRatio
to be 1
on the "Completed" steps (but use their same start/end as the non-completed). Sth like
switch status {
case TranscodeStatusPreparing, TranscodeStatusPreparingCompleted:
start, end = 0, 0.4
case TranscodeStatusTranscoding, TranscodeStatusTranscodingCompleted:
start, end = 0.4, 1
}
if (status == TranscodeStatusPreparingCompleted || status == TranscodeStatusTranscodingCompleted) {
currentStageCompletionRatio = 1
}
Then there could be a single progress-scaling function like this: https://github.com/livepeer/task-runner/blob/4d1ae1768c01e979969bf7f00b81267db05e299c/task/progress.go#L66
Certainly not a required change, just tripping on the impl. Could make sense when we start adding more steps here. WDYT?
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.
I like that a lot!
switch status { | ||
case TranscodeStatusPreparing, TranscodeStatusPreparingCompleted: | ||
return scaleProgress(currentStageCompletionRatio, 0, 0.4) | ||
case TranscodeStatusTranscoding, TranscodeStatusCompleted: | ||
return scaleProgress(currentStageCompletionRatio, 0.4, 1) | ||
} |
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.
Nice!
No description provided.