-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enqueue --wait returns task exit code
Signed-off-by: aavarghese <[email protected]>
- Loading branch information
1 parent
22e7554
commit 12d2fbe
Showing
16 changed files
with
187 additions
and
14 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
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,3 @@ | ||
# test7-wait-withfail | ||
|
||
Same as test7, except this test uses the ParameterSweep in "wait" mode with one failing task. |
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,37 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTDIR=$(cd $(dirname "$0") && pwd) | ||
|
||
export NAMESPACE=$1 | ||
|
||
# number of task | ||
N=${2-10} | ||
|
||
# name of s3 bucket in which to store the tasks | ||
BUCKET=${3-test7} | ||
RUN_NAME=$BUCKET | ||
|
||
B=$(mktemp -d)/$BUCKET # bucket path | ||
D=$B/$BUCKET # data path; in this case the bucket name and the folder name are both the run name | ||
mkdir -p $D | ||
echo "Staging to $D" 1>&2 | ||
|
||
for idx in $(seq 1 $N) # for each iteration | ||
do | ||
# if we are doing a test, then make sure to use a | ||
# repeatable name for the task files, so that we know what | ||
# to look for when confirming that the tasks were | ||
# processed by the workers | ||
if [[ -n "$CI" ]] || [[ -n "$RUNNING_CODEFLARE_TESTS" ]]; then | ||
id=$idx | ||
else | ||
# otherwise, use a more random name, so that we can | ||
# inject multiple batches of tasks across executions | ||
# of this script | ||
id=$(uuidgen) | ||
fi | ||
|
||
echo "this is task idx=$idx" > $D/task.$id.txt | ||
done | ||
|
||
"$SCRIPTDIR"/../../../tests/bin/add-data.sh $B |
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,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPTDIR=$(cd $(dirname "$0") && pwd) | ||
|
||
# make sure these values are compatible with the values in ./settings.sh | ||
NUM_TASKS=6 | ||
|
||
# $1: namespace | ||
|
||
"$SCRIPTDIR"/add-data-to-queue.sh \ | ||
$1 \ | ||
$NUM_TASKS \ | ||
${TEST_NAME-test7} |
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,47 @@ | ||
apiVersion: lunchpail.io/v1alpha1 | ||
kind: Application | ||
metadata: | ||
name: test7-wait-withfail | ||
spec: | ||
role: worker | ||
code: | ||
- name: main.sh | ||
source: | | ||
#!/usr/bin/env sh | ||
# $1 input filepath | ||
# $2 output filepath | ||
in="$1" | ||
out="$2" | ||
dataset_name=test # match with below! | ||
bucket_name=test7-wait-withfail | ||
folder_name=test7-wait-withfail | ||
N=$(ls $dataset_name/$bucket_name/$folder_name | wc -l | xargs) | ||
echo "Processing $N $(basename $in)" | ||
sleep 5 | ||
if [ $(basename $in) = "task.3.txt" ] | ||
then | ||
echo "Error!" 1>&2 | ||
exit 64 | ||
fi | ||
echo "Done with $(basename $in)" | ||
command: ./main.sh | ||
minSize: auto | ||
securityContext: | ||
runAsUser: 2000 # lunchpail, same as is specified Dockerfile | ||
runAsGroup: 0 # root, ibid | ||
containerSecurityContext: | ||
runAsUser: 2000 # lunchpail, same as is specified Dockerfile | ||
runAsGroup: 0 # root, ibid | ||
|
||
datasets: | ||
- name: test | ||
s3: | ||
secret: test7data | ||
copyIn: | ||
path: "test7-wait-withfail/" |
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,9 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: test7data | ||
type: Opaque | ||
stringData: | ||
endpoint: {{ .Values.global.s3Endpoint }} | ||
accessKeyID: {{ .Values.global.s3AccessKey }} | ||
secretAccessKey: {{ .Values.global.s3SecretKey }} |
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,11 @@ | ||
apiVersion: lunchpail.io/v1alpha1 | ||
kind: ParameterSweep | ||
metadata: | ||
name: test7-wait-withfail-workdispatcher | ||
spec: | ||
min: 1 | ||
max: {{ .Values.nTasks | default 5 }} | ||
step: 1 | ||
interval: {{ .Values.every | default 5 }} | ||
wait: true | ||
verbose: true |
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,8 @@ | ||
apiVersion: lunchpail.io/v1alpha1 | ||
kind: WorkerPool | ||
metadata: | ||
name: test7-wait-withfail-pool1 | ||
spec: | ||
workers: | ||
count: 2 | ||
size: auto |
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 @@ | ||
3.1.4.1 |
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,8 @@ | ||
api=workqueue | ||
taskqueue=test7-wait-withfail | ||
|
||
# /queue/0,1 <-- 2 workers | ||
# task.1,task.3,task.5 <-- 3 tasks per iter | ||
|
||
expected=("Processing 6 task.1.txt" "Task completed task.1.txt" "Task completed task.1.txt with return code 0" "Task completed task.3.txt" "Task completed task.3.txt with return code 64") | ||
expectTaskFailure=64 |
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