Skip to content

Commit

Permalink
fix(demo): run kanban demo in an infinite loop
Browse files Browse the repository at this point in the history
This commit addresses an issue where the producer in the Kanban demo
would halt after generating a certain number of jobs. Earlier, even if
the producer was restarted, it wouldn’t resume the job generation due to
the presence of a '.done' marker file.
The marker file mechanism was therefore replaced with a simple polling
approach. Now restarting the producer works and will result in new jobs
being generated.

Signed-off-by: Michael Adler <michael.adler@siemens.com>
  • Loading branch information
michaeladler authored and stormc committed Aug 2, 2023
1 parent 5080e52 commit 873e09f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 0 additions & 2 deletions share/demo/kanban/02-create-workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,3 @@ VALIDATE ─────┤
▼ ▼
DONE DISCARDED
EOF

touch 02-create-workflow.sh.done
29 changes: 18 additions & 11 deletions share/demo/kanban/03-producer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
# Author: Michael Adler <michael.adler@siemens.com>

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
rm -f 02-create-workflow.sh.done

# hide the evidence
clear

echo "# waiting for workflow..."
while [[ ! -e 02-create-workflow.sh.done ]]; do
sleep 0.5
echo "# waiting for kanban workflow..."
while true; do
RC=0
wfxctl workflow get --name=wfx.workflow.kanban 1>/dev/null 2>&1 || RC=$?
if [[ $RC -eq 0 ]]; then
break
fi
sleep 3
done
echo "# found kanban workflow"

########################
# include the magic
Expand All @@ -27,11 +32,13 @@ PROMPT_TIMEOUT=2

CLIENTS=("$@")
TASKID=1
for client in "${CLIENTS[@]}"; do
clear
p "# create a task for developer $client"
p "echo '{ \"title\": \"Task $TASKID\" }' | wfxctl job create --workflow wfx.workflow.kanban --client-id $client --filter 'del(.workflow)'"
echo "{ \"title\": \"Task $TASKID\" }" | wfxctl job create --workflow wfx.workflow.kanban --client-id "$client" --filter 'del(.workflow)' -
sleep 3
TASKID=$((TASKID + 1))
while true; do
for client in "${CLIENTS[@]}"; do
clear
p "# create a task for developer $client"
p "echo '{ \"title\": \"Task $TASKID\" }' | wfxctl job create --workflow wfx.workflow.kanban --client-id $client --filter 'del(.workflow)'"
echo "{ \"title\": \"Task $TASKID\" }" | wfxctl job create --workflow wfx.workflow.kanban --client-id "$client" --filter 'del(.workflow)' -
sleep 3
TASKID=$((TASKID + 1))
done
done

0 comments on commit 873e09f

Please sign in to comment.