forked from mtusi2026/mtusi2026lab5
feat(worker): add versioned image processing
This commit is contained in:
@@ -10,8 +10,8 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func ProcessImage(maxPixels int) error {
|
||||
variants, err := imageVariants(os.Stdin, maxPixels)
|
||||
func ProcessImage(maxPixels, pipelineVersion int) error {
|
||||
variants, err := imageVariants(os.Stdin, maxPixels, pipelineVersion)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -19,13 +19,16 @@ func ProcessImage(maxPixels int) error {
|
||||
return gob.NewEncoder(os.Stdout).Encode(variants)
|
||||
}
|
||||
|
||||
func runImageProcess(ctx context.Context, source *os.File, maxPixels int) ([]imageVariant, error) {
|
||||
func runImageProcess(ctx context.Context, source *os.File, maxPixels, pipelineVersion int) ([]imageVariant, error) {
|
||||
executable, err := os.Executable()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cmd := exec.CommandContext(ctx, executable, "-process-image", strconv.Itoa(maxPixels))
|
||||
cmd := exec.CommandContext(ctx, executable,
|
||||
"-process-image", strconv.Itoa(maxPixels),
|
||||
"-pipeline-version", strconv.Itoa(pipelineVersion),
|
||||
)
|
||||
cmd.Stdin = source
|
||||
data, err := cmd.Output()
|
||||
if ctx.Err() != nil {
|
||||
|
||||
Reference in New Issue
Block a user