You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run.sh 3.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. # Copyright 2021 The KubeEdge Authors.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. VA_LABEL="videoanalyticsjob.sedna.io/name=video-analytics"
  16. REID_LABEL="reidjob.sedna.io/name=reid"
  17. FE_LABEL="app.sedna.io=feature-extraction-fe-svc"
  18. sp="/-\|"
  19. function check_pod_status {
  20. local func_result="$(kubectl get pod -l $1 -o json | jq ".items[0].status.phase")"
  21. echo "$func_result"
  22. }
  23. ### FEATURE EXTRACTION ###
  24. # create feature extraction service
  25. echo "⚪ Create Feature Extraction service."
  26. kubectl apply -f ../yaml/feature-extraction-service.yaml
  27. # check that FE is running
  28. while [ $(check_pod_status $FE_LABEL) != '"Running"' ]
  29. do
  30. echo -ne "🟡 Feature Extraction service is not ready ${sp:i++%${#sp}:1} \r"
  31. sleep 0.2
  32. done
  33. echo -n "" && echo "🟢 Feature Extraction service is ready."
  34. ### VIDEO ANALYTICS ###
  35. # create VideoAnalytics Job
  36. echo "⚪ Create VideoAnalytics job."
  37. kubectl apply -f ../yaml/video-analytics-job.yaml
  38. # wait for the job to be ready
  39. while [ $(check_pod_status $VA_LABEL) != '"Running"' ] && [ $(check_pod_status $VA_LABEL) != '"Succeeded"' ]
  40. do
  41. echo -ne "🟡 VideoAnalytics job is not ready ${sp:i++%${#sp}:1} \r"
  42. sleep 0.2
  43. done
  44. echo -n "" && echo "🟢 VideoAnalytics job is ready."
  45. # wait for the job to complete
  46. while [ $(check_pod_status $VA_LABEL) != '"Succeeded"' ]
  47. do
  48. echo -ne "🟡 Waiting for VideoAnalytics job completion (this will take awhile) ${sp:i++%${#sp}:1} \r"
  49. sleep 0.2
  50. done
  51. echo -n "" && echo "🟢 VideoAnalytics job has completed."
  52. echo "⚪ Clean-up VideoAnalytics job resources."
  53. kubectl delete -f ../yaml/video-analytics-job.yaml
  54. ### REID ###
  55. # create ReID job
  56. echo "⚪ Create ReID job."
  57. kubectl apply -f ../yaml/reid-job.yaml
  58. # wait for the job to be ready
  59. while [ $(check_pod_status $REID_LABEL) != '"Running"' ] && [ $(check_pod_status $REID_LABEL) != '"Succeeded"' ]
  60. do
  61. echo -ne "🟡 ReID job is not ready ${sp:i++%${#sp}:1} \r"
  62. sleep 0.2
  63. done
  64. echo -n "" && echo "🟢 ReID job is ready."
  65. # wait for the job to complete
  66. while [ $(check_pod_status $REID_LABEL) != '"Succeeded"' ]
  67. do
  68. echo -ne "🟡 Waiting for ReID job completion (this will take awhile) ${sp:i++%${#sp}:1} \r"
  69. sleep 0.2
  70. done
  71. echo -n "" && echo "🟢 ReID job has completed."
  72. echo "⚪ Clean-up ReID job resources."
  73. kubectl delete -f ../yaml/reid-job.yaml
  74. # remove feature extraction service
  75. echo "⚪ Remove Feature Extraction service."
  76. kubectl delete -f ../yaml/feature-extraction-service.yaml
  77. # restart kafka pod to clean dirty topics
  78. echo "⚪ Clean-up Kafka broker."
  79. kubectl delete pod -l app=kafka
  80. # exit
  81. echo "🟢 Done!"