Skip to content

Commit

Permalink
Update mmsys-test-encode examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mtneug committed Feb 2, 2024
1 parent 3f84d72 commit f9a36bf
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 23 deletions.
17 changes: 6 additions & 11 deletions config/samples/k8s/mmsys-test-encode/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example for mmsys-test-encode operation
# Example for `mmsys-test-encode` function

This example shows task execution of the `mmsys-test-encode` function demonstrating MPEG NBMP task error recovery using event sourcing. The NBMP tasks are created directly without going through the NBMP Workflow API and the full workflow manager. However, the nagare media engine `workflow-manager-helper` is deployed as a sidecar container next to the task container. The `workflow-manager-helper` will read the mounted secret and configure the task using the NBMP Task API. It then monitors the execution status.

Expand All @@ -8,18 +8,18 @@ The `mmsys-test-encode` function can be configured with the following options:
| ----------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `mmsys-test-encode.engine.nagare.media/test` | Execution test/mode to use (s. below). (required) |
| `mmsys-test-encode.engine.nagare.media/chunk-seconds` | Duration of a chunk for split-merge execution modes. (required) |
| `mmsys-test-encode.engine.nagare.media/max-number-of-simulated-crashes` | Number crashes, i.e. hard terminations, to simulate (defaults to 2) |
| `mmsys-test-encode.engine.nagare.media/simulated-crash-wait-duration` | Time to wait until simulated crash is triggered. (defaults to 120s) |
| `mmsys-test-encode.engine.nagare.media/max-number-of-simulated-crashes` | Number crashes, i.e. hard terminations, to simulate (defaults to 1) |
| `mmsys-test-encode.engine.nagare.media/simulated-crash-wait-duration` | Time to wait until simulated crash is triggered. (defaults to 60s) |

The following execution tests/modes exist:

| Test | Description |
| ---------------------------- | --------------------------------------------------------------------- |
| baseline-simple | Simple encode of the whole file. |
| baseline-split-merge | Simple split-and-merge encode. The chunks are processes sequentially. |
| test-no-recovery-simple | Encode of the whole file with simulated crashes without recovery. |
| test-no-recovery-split-merge | Split-and-merge encode with simulated crashes without recovery. |
| test-recovery-split-merge | Split-and-merge encode with simulated crashed with recovery. |
| test-no-recovery-simple | Encode of the whole file with simulated crashes and no recovery. |
| test-no-recovery-split-merge | Split-and-merge encode with simulated crashes and no recovery. |
| test-recovery-split-merge | Split-and-merge encode with simulated crashed and recovery. |

## Host environment

Expand Down Expand Up @@ -94,35 +94,30 @@ In every test case, the output encoding can be accessed at <http://s3.local.gd/n
# baseline-simple
$ kubectl -n mmsys-test-encode create secret generic workflow-manager-helper-data-mmsys-test-encode-baseline-simple \
--from-file=data.yaml=config/samples/nagare-media/workflow-manager-helper-data_mmsys-test-encode-baseline-simple.yaml

$ kubectl -n mmsys-test-encode apply -f config/samples/k8s/mmsys-test-encode/job-task-mmsys-test-encode-baseline-simple.yaml
$ kubectl logs -f -n mmsys-test-encode jobs/task-mmsys-test-encode-baseline-simple -c function

# baseline-split-merge
$ kubectl -n mmsys-test-encode create secret generic workflow-manager-helper-data-mmsys-test-encode-baseline-split-merge \
--from-file=data.yaml=config/samples/nagare-media/workflow-manager-helper-data_mmsys-test-encode-baseline-split-merge.yaml

$ kubectl -n mmsys-test-encode apply -f config/samples/k8s/mmsys-test-encode/job-task-mmsys-test-encode-baseline-split-merge.yaml
$ kubectl logs -f -n mmsys-test-encode jobs/task-mmsys-test-encode-baseline-split-merge -c function

# test-no-recovery-simple
$ kubectl -n mmsys-test-encode create secret generic workflow-manager-helper-data-mmsys-test-encode-test-no-recovery-simple \
--from-file=data.yaml=config/samples/nagare-media/workflow-manager-helper-data_mmsys-test-encode-test-no-recovery-simple.yaml

$ kubectl -n mmsys-test-encode apply -f config/samples/k8s/mmsys-test-encode/job-task-mmsys-test-encode-test-no-recovery-simple.yaml
$ kubectl logs -f -n mmsys-test-encode jobs/task-mmsys-test-encode-test-no-recovery-simple -c function

# test-no-recovery-split-merge
$ kubectl -n mmsys-test-encode create secret generic workflow-manager-helper-data-mmsys-test-encode-test-no-recovery-split-merge \
--from-file=data.yaml=config/samples/nagare-media/workflow-manager-helper-data_mmsys-test-encode-test-no-recovery-split-merge.yaml

$ kubectl -n mmsys-test-encode apply -f config/samples/k8s/mmsys-test-encode/job-task-mmsys-test-encode-test-no-recovery-split-merge.yaml
$ kubectl logs -f -n mmsys-test-encode jobs/task-mmsys-test-encode-test-no-recovery-split-merge -c function

# test-recovery-split-merge
$ kubectl -n mmsys-test-encode create secret generic workflow-manager-helper-data-mmsys-test-encode-test-recovery-split-merge \
--from-file=data.yaml=config/samples/nagare-media/workflow-manager-helper-data_mmsys-test-encode-test-recovery-split-merge.yaml

$ kubectl -n mmsys-test-encode apply -f config/samples/k8s/mmsys-test-encode/job-task-mmsys-test-encode-test-recovery-split-merge.yaml
$ kubectl logs -f -n mmsys-test-encode jobs/task-mmsys-test-encode-test-recovery-split-merge -c function
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task:
url: http://minio.s3.svc.cluster.local:9000/nagare-media-engine-tests/inputs/caminandes-1-llama-drama.mp4
metadata:
streams:
- duration: 14m48s
- duration: 1m30s
video:
frameRate:
average: 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task:
url: http://minio.s3.svc.cluster.local:9000/nagare-media-engine-tests/inputs/caminandes-1-llama-drama.mp4
metadata:
streams:
- duration: 14m48s
- duration: 1m30s
video:
frameRate:
average: 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task:
url: http://minio.s3.svc.cluster.local:9000/nagare-media-engine-tests/inputs/caminandes-1-llama-drama.mp4
metadata:
streams:
- duration: 14m48s
- duration: 1m30s
video:
frameRate:
average: 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task:
url: http://minio.s3.svc.cluster.local:9000/nagare-media-engine-tests/inputs/caminandes-1-llama-drama.mp4
metadata:
streams:
- duration: 14m48s
- duration: 1m30s
video:
frameRate:
average: 24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ task:
url: http://minio.s3.svc.cluster.local:9000/nagare-media-engine-tests/inputs/caminandes-1-llama-drama.mp4
metadata:
streams:
- duration: 14m48s
- duration: 1m30s
video:
frameRate:
average: 24
Expand Down
11 changes: 4 additions & 7 deletions internal/functions/mmsys-test-encode/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,20 @@ const (
MaxNumberOfSimulatedCrashesParameterKey = "mmsys-test-encode.engine.nagare.media/max-number-of-simulated-crashes"
SimulatedCrashWaitDurationParameterKey = "mmsys-test-encode.engine.nagare.media/simulated-crash-wait-duration"

DefaultMaxNumberOfSimulatedCrashes = 2
DefaultSimulatedCrashWaitDuration = 120 * time.Second
DefaultMaxNumberOfSimulatedCrashes = 1
DefaultSimulatedCrashWaitDuration = 60 * time.Second
)

const (
// * baseline 1: simple encoding
// * baseline 2: split+merge encoding
// * baseline 3: split+merge encoding distributed
//
// with two disruptions:
// with n disruptions:
// no event sourcing:
// * test 1: simple encoding
// * test 2: split+merge encoding
// * test 3: split+merge encoding distributed
// event sourcing:
// * test 4: split+merge encoding
// * test 5: split+merge encoding distributed

BaselineSimple = "baseline-simple"
BaselineSplitMerge = "baseline-split-merge"
Expand Down Expand Up @@ -640,7 +637,7 @@ func (f *function) setupSimulatedCrash(ctx context.Context) {
return
}

// simulate hard crash after 2m
// simulate hard crash
l.Info("enable simulated crash")
go func() {
time.Sleep(f.simulatedCrashWaitDuration)
Expand Down

0 comments on commit f9a36bf

Please sign in to comment.