Skip to content

Commit

Permalink
Improve e2e science, self-hosted test
Browse files Browse the repository at this point in the history
Configure fine-grained resource management
Fix fink startup script error management
Use 3GB memory for raw2science
Configure number of expected topics for e2e test output
  • Loading branch information
fjammes authored and Your Name committed Jan 30, 2024
1 parent b91f22f commit 7788001
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ env:
CIUX_VERSION: v0.0.1-rc12
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
NOSCIENCE: true
MINIMAL: true
jobs:
build:
name: Build image
Expand Down Expand Up @@ -68,7 +67,7 @@ jobs:
ktbx install argocd
- name: Run argoCD
run: |
./itest/argocd.sh
./e2e/argocd.sh
- name: Download image
uses: actions/download-artifact@v3
with:
Expand All @@ -93,13 +92,13 @@ jobs:
run: |
sudo apt-get -y update
sudo apt-get -y install openjdk-8-jdk-headless
./itest/prereq-install.sh
./e2e/prereq-install.sh
- name: Run fink-broker
run: |
./itest/fink-start.sh
./e2e/fink-start.sh
- name: Check results
run: |
./itest/check-results.sh
./e2e/check-results.sh
image-analysis:
name: Analyze image
runs-on: ubuntu-22.04
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ on:

jobs:
call-workflow-passing-data:
uses: ./.github/workflows/itest.yml
uses: ./.github/workflows/e2e.yml
with:
minimal: true
noscience: true
secrets:
registry_username: ${{ secrets.REGISTRY_USERNAME }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ on:

jobs:
call-workflow-passing-data:
uses: ./.github/workflows/itest.yml
uses: ./.github/workflows/e2e.yml
with:
minimal: false
noscience: false
secrets:
registry_username: ${{ secrets.REGISTRY_USERNAME }}
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/itest.yml → .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: "Reusable workflow for Fink self-hosted e2e tests"
on:
workflow_call:
inputs:
minimal:
required: true
type: string
noscience:
required: true
type: string
Expand All @@ -18,7 +15,6 @@ env:
CIUXCONFIG: /tmp/ciux.sh
CIUX_VERSION: v0.0.1-rc12
GHA_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
MINIMAL: ${{ inputs.minimal }}
NOSCIENCE: ${{ inputs.noscience }}
# Override the self-hosted runner value
POD_NAMESPACE: default
Expand Down Expand Up @@ -108,7 +104,7 @@ jobs:
ktbx install argocd
- name: Run argoCD
run: |
./itest/argocd.sh
./e2e/argocd.sh
- name: Load fink-broker image inside kind
run: |
IMAGE=${{ needs.build.outputs.image }}
Expand All @@ -125,7 +121,7 @@ jobs:
run: |
sudo apt-get -y update
sudo apt-get -y install openjdk-8-jdk-headless
./itest/prereq-install.sh
./e2e/prereq-install.sh
- name: Run fink-alert-simulator
run: |
. "$CIUXCONFIG"
Expand All @@ -135,10 +131,10 @@ jobs:
# uses: mxschmitt/action-tmate@v3
- name: Run fink-broker
run: |
./itest/fink-start.sh
./e2e/fink-start.sh
- name: Check ouput topics are created
run: |
./itest/check-results.sh
./e2e/check-results.sh
image-analysis:
name: Analyze image
runs-on: [self-hosted, v3]
Expand Down
2 changes: 1 addition & 1 deletion TODO.org
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

* DONE trigger ci for OOMkill
* 729
** DONE use "kubectl get kafkatopics.kafka.strimzi.io -n kafka" to check success of integration tests, maybe in fnkctl?
** TODO DELAYED BECAUSE IT NOT BLOCKS BUT WARN create topic in distribute before sending alerts in order to avoid error below: https://fink-broker.slack.com/archives/D03KJ390F17/p1692008729660549
Expand Down
2 changes: 1 addition & 1 deletion conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
. "$CIUXCONFIG"

# Do not launch science pipeline if true
# Set minimal limits/requests for Spark driver and executor if true
NOSCIENCE="${NOSCIENCE:-false}"

# Set minimal limits/requests for Spark driver and executor if true
MINIMAL="${MINIMAL:-false}"


Expand Down
File renamed without changes.
22 changes: 21 additions & 1 deletion itest/check-results.sh → e2e/check-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,25 @@ DIR=$(cd "$(dirname "$0")"; pwd -P)

. $DIR/../conf.sh

finkctl wait topics --expected 11 --timeout 600s -v1
# TODO improve management of expected topics
# for example in the argo workflow job witch launch the alert simulator
if [ $NOSCIENCE = true ]
then
EXPECTED_TOPICS="11"
else
EXPECTED_TOPICS="1"
fi

count=0
while ! finkctl wait topics --expected "$EXPECTED_TOPICS" --timeout 60s -v1
do
echo "Waiting for topics to be created"
sleep 5
kubectl get pods
count=$((count+1))
if [ $count -eq 10 ]; then
echo "Timeout waiting for topics to be created"
exit 1
fi
done
finkctl get topics
35 changes: 18 additions & 17 deletions itest/fink-start.sh → e2e/fink-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,17 @@ echo "Create S3 bucket"
kubectl port-forward -n minio svc/minio 9000 &
# Wait to port-forward to start
sleep 2
export FINKCONFIG="$DIR"

if [ "$NOSCIENCE" = true ];
then
NOSCIENCE_OPT="--noscience"
export FINKCONFIG="$DIR/finkconfig_noscience"
else
NOSCIENCE_OPT=""
export FINKCONFIG="$DIR/finkconfig"
fi


finkctl --endpoint=localhost:9000 s3 makebucket

echo "Create spark ServiceAccount"
Expand All @@ -48,33 +58,24 @@ NS=$(kubectl get sa -o=jsonpath='{.items[0]..metadata.namespace}')
kubectl create clusterrolebinding spark-role --clusterrole=edit --serviceaccount=$NS:spark \
--namespace=default --dry-run=client -o yaml | kubectl apply -f -

if [ "$NOSCIENCE" = true ];
then
NOSCIENCE_OPT="--noscience"
else
NOSCIENCE_OPT=""
fi

if [ "$MINIMAL" = true ];
then
MINIMAL_OPT="--minimal"
else
MINIMAL_OPT=""
fi

tasks="stream2raw raw2science distribution"
for task in $tasks; do
finkctl run $MINIMAL_OPT $NOSCIENCE_OPT $task --image $IMAGE >& "/tmp/$task.log" &
finkctl run $NOSCIENCE_OPT $task --image $IMAGE >& "/tmp/$task.log" &
done

# Wait for Spark pods to be created and warm up
# Debug in case of not expected behaviour
if ! finkctl wait tasks --timeout=180s
if ! finkctl wait tasks --timeout=300s
then
for task in $tasks; do
echo "--------- $task log file ---------"
cat "/tmp/$task.log"
done
kubectl describe pods -l "spark-role in (executor, driver)"
kubectl get pods
echo "ERROR: unable to start fink-broker"
exit 1
fi

kubectl describe pods -l "spark-role in (executor, driver)"
kubectl get pods
1 change: 1 addition & 0 deletions e2e/finkconfig/finkctl.secret.yaml
2 changes: 2 additions & 0 deletions itest/finkctl.yaml → e2e/finkconfig/finkctl.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
apiVersion: v1alpha1
s3:
endpoint: http://minio.minio:9000
use_ssl: "false"
Expand All @@ -17,6 +18,7 @@ stream2raw:
kafka_starting_offset: earliest
kafka_topic: ztf-stream-sim
raw2science:
memory: 3000m
night: "20200101"
distribution:
# Comma-separated list of kafka servers, default to stream2raw.kafka_socket
Expand Down
File renamed without changes.
31 changes: 31 additions & 0 deletions e2e/finkconfig_noscience/finkctl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1alpha1
s3:
endpoint: http://minio.minio:9000
use_ssl: "false"
bucket: fink-broker-online
# General parameter used to run fink tasks
run:
cpu: 0
memory: 466m
fink_trigger_update: "2"
# Can be set using --image option
# image: gitlab-registry.in2p3.fr/astrolabsoftware/fink/fink-broker:2.7.1-33-ge27a2aa-dirty
# Default to s3a://<s3.bucket>
# online_data_prefix: s3a://fink-broker-online
producer: sims
log_level: INFO
stream2raw:
fink_alert_schema: /home/fink/fink-alert-schemas/ztf/ztf_public_20190903.schema.avro
kafka_socket: kafka-cluster-kafka-bootstrap.kafka:9092
kafka_starting_offset: earliest
kafka_topic: ztf-stream-sim
raw2science:
night: "20200101"
distribution:
# Comma-separated list of kafka servers, default to stream2raw.kafka_socket
distribution_servers: "kafka-cluster-kafka-external-bootstrap.kafka:9094"
distribution_schema: "/home/fink/fink-alert-schemas/ztf/distribution_schema_0p2.avsc"
substream_prefix: "fink_"
# Default to <stream2raw.night>
# night: "20200101"

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7788001

Please sign in to comment.