Comments (1)
instead shell retry rebuild
sh rebuild.sh namespace
#!/bin/bash
#最大重试次数
MAX_ATTEMPTS=3
#间隔时间
RETRY_DELAY=20
#命名空间
NAMESPACE="$1"
check_build_status() {
local packageId="$1"
# 假定的查询构建状态命令,请替换为实际可用的API调用
local status=$(get_status $packageId)
echo "Checking status for $packageId: $status"
[ "$status" = "succeeded" ]
}
get_status(){
local packageId="$1"
local status=$(fission pkg list -n $NAMESPACE | grep $packageId | awk '{print $2}') # 示例中简化处理,实际需调用API获取状态
echo "$status"
}
rebuild_and_check() {
local packageId="$1"
local attempt=0
while [ $attempt -lt $MAX_ATTEMPTS ]; do
echo "Rebuilding attempt $((attempt+1)) for node: $packageId"
# 假定的重建命令,请替换为实际可用的命令
local status=$(get_status "$packageId")
echo "current $status"
if [ "$status" = "failed" ]; then
fission pkg rebuild --name "$packageId" -n $NAMESPACE
fi
if check_build_status "$packageId"; then
echo "Rebuild for $packageId succeeded after $((attempt+1)) attempts."
trigger_post_request "$packageId"
return 0
fi
((attempt++))
sleep $RETRY_DELAY
done
echo "Failed to rebuild $packageId after $MAX_ATTEMPTS attempts. Skipping to next."
return 1
}
trigger_post_request() {
local packageId="$1"
local functionName="${packageId#node-}"
local url=$(kubectl get node -o wide | grep -E '^.*Ready.*master' | awk '{print $6}'| head -n 1)
local response=$(curl -sS -X POST -m 10 "http://$url:31314/$functionName")
echo "request $functionName, response $response"
}
get_failed_packages(){
local failed_packages=($(fission pkg list -n $NAMESPACE | grep failed | awk '{print $1}'))
# 主处理逻辑
for packageId in "${failed_packages[@]}"; do
if rebuild_and_check "$packageId"; then
continue # 成功重建并触发请求后,正常继续下一个
else
#在这里可以添加额外的逻辑,比如记录失败的节点等
echo "$packageId build failed"
fi
done
}
get_failed_packages
echo "All nodes processed with retry logic applied."
from fission.
Related Issues (20)
- How to count the 99% tail delay quantile of Fission
- Utilize .Release.Name as Standard Prefix for All Kubernetes Resources in Helm Chart
- [help] how to build fission-bundle image
- Unable to Create Duplicate HTTP Trigger Names Across Different Namespaces HOT 1
- Fission watch all namespaces HOT 1
- Loki integration Issue HOT 5
- Router cannot create resource Ingresses HOT 2
- Fission helm conflicts with Rancher HOT 1
- [help] Is it possible to create a Python function from a zipped release in GitHub?
- Failed to create MessageQueueTrigger HOT 1
- "fission check" does not work outside of "fission" namespace
- Thoughts on the Functional Positioning of the Executor Component
- fission package build stuck in running HOT 1
- Package build trigger mechanism (esp. if fission packages are deployed with gitops)
- help,help,help v1.18.0 I get error buildermgr , envwatcher not get watcher to create env by controller
- fetcher archive code why use DefaultZip HOT 1
- Download source code to file error when using fission command
- fission spec apply --delete fails to delete environment
- Scale fission function pods per function call HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fission.