-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/ffmpeg execute ffmpeg through temporal
- Loading branch information
1 parent
733d72c
commit 20b5880
Showing
4 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package workflows | ||
|
||
import ( | ||
"github.com/bcc-code/bccm-flows/activities" | ||
"github.com/bcc-code/bccm-flows/utils" | ||
"go.temporal.io/sdk/temporal" | ||
"go.temporal.io/sdk/workflow" | ||
"time" | ||
) | ||
|
||
type ExecuteFFmpegInput struct { | ||
Arguments []string | ||
} | ||
|
||
func ExecuteFFmpeg( | ||
ctx workflow.Context, | ||
params ExecuteFFmpegInput, | ||
) error { | ||
logger := workflow.GetLogger(ctx) | ||
options := workflow.ActivityOptions{ | ||
RetryPolicy: &temporal.RetryPolicy{ | ||
InitialInterval: time.Minute * 1, | ||
MaximumAttempts: 10, | ||
MaximumInterval: time.Hour * 1, | ||
}, | ||
StartToCloseTimeout: time.Hour * 4, | ||
ScheduleToCloseTimeout: time.Hour * 48, | ||
HeartbeatTimeout: time.Minute * 1, | ||
TaskQueue: utils.GetTranscodeQueue(), | ||
} | ||
|
||
ctx = workflow.WithActivityOptions(ctx, options) | ||
|
||
logger.Info("Starting ExecuteFFmpeg") | ||
|
||
err := workflow.ExecuteActivity(ctx, activities.ExecuteFFmpeg, activities.ExecuteFFmpegInput{ | ||
Arguments: params.Arguments, | ||
}).Get(ctx, nil) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
return err | ||
} |