Meaningful error message when fetch request is received for a package when build is not successful. (#661)

This commit is contained in:
smruthi2187
2018-05-03 22:51:48 +08:00
committed by Ta-Ching Chen
parent 2ece0db13f
commit f0dc2554a1
5 changed files with 14 additions and 5 deletions
+9
View File
@@ -254,6 +254,15 @@ func (fetcher *Fetcher) Fetch(req FetchRequest) (int, error) {
if req.FetchType == FETCH_SOURCE {
archive = &pkg.Spec.Source
} else if req.FetchType == FETCH_DEPLOYMENT {
// sometimes, the user may invoke the function even before the source code is built into a deploy pkg.
// this results in executor sending a fetch request of type FETCH_DEPLOYMENT and since pkg.Spec.Deployment.Url will be empty,
// we hit this "Get : unsupported protocol scheme "" error.
// it may be useful to the user if we can send a more meaningful error in such a scenario.
if pkg.Status.BuildStatus != fission.BuildStatusSucceeded && pkg.Status.BuildStatus != fission.BuildStatusNone {
e := fmt.Sprintf("Build status for the function's pkg : %s.%s is : %s, can't fetch deployment", pkg.Metadata.Name, pkg.Metadata.Namespace, pkg.Status.BuildStatus)
log.Printf(e)
return 500, errors.New(e)
}
archive = &pkg.Spec.Deployment
}
// get package data as literal or by url
@@ -50,7 +50,7 @@ sed -i 's/world/fission/' test_dir/hello.py
zip -jr test-deploy-pkg.zip test_dir/
log "Updating function with updated package"
fission fn update --name $fn_name --env $env --deploy test-deploy-pkg.zip --entrypoint "hello.main" --executortype newdeploy --minscale 1 --maxscale 4 --targetcpu 50
fission fn update --name $fn_name --deploy test-deploy-pkg.zip --entrypoint "hello.main" --executortype newdeploy --minscale 1 --maxscale 4 --targetcpu 50
log "Waiting for deployment to update"
sleep 5
+2 -2
View File
@@ -25,7 +25,7 @@ sleep 5
timeout 60 bash -c "test_fn $fn 'world'"
log "Updating function $fn executor type to new deployment"
fission fn update --name $fn --env $env --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy
fission fn update --name $fn --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy
log "Waiting for router to catch up"
sleep 5
@@ -33,7 +33,7 @@ sleep 5
timeout 60 bash -c "test_fn $fn 'world'"
log "Updating function $fn executor type back to pool manager"
fission fn update --name $fn --env $env --code $ROOT/examples/python/hello.py --executortype poolmgr
fission fn update --name $fn --code $ROOT/examples/python/hello.py --executortype poolmgr
log "Waiting for router to catch up"
sleep 5
@@ -55,7 +55,7 @@ fi
timeout 60 bash -c "test_fn $fn 'world'"
log "Updating function $fn with new resource values"
fission fn update --name $fn --env $env --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy --mincpu $mincpu2 --maxcpu $maxcpu2 --minmemory $minmem2 --maxmemory $maxmem2
fission fn update --name $fn --code $ROOT/examples/python/hello.py --minscale 1 --maxscale 4 --executortype newdeploy --mincpu $mincpu2 --maxcpu $maxcpu2 --minmemory $minmem2 --maxmemory $maxmem2
maxcpu_actual=$(kubectl get $func $fn -n default -ojsonpath='{.spec.resources.limits.cpu}'|tr -dc '0-9')
mincpu_actual=$(kubectl get $func $fn -n default -ojsonpath='{.spec.resources.requests.cpu}'|tr -dc '0-9')
@@ -28,7 +28,7 @@ sleep 5
timeout 60 bash -c "test_fn $fn 'world'"
log "Updating function scale and target CPU percent for $fn"
fission fn update --name $fn --env $env --code $ROOT/examples/python/hello.py --minscale $targetMinScale --maxscale $targetMaxScale --targetcpu $targetCpuPercent --executortype newdeploy --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
fission fn update --name $fn --code $ROOT/examples/python/hello.py --minscale $targetMinScale --maxscale $targetMaxScale --targetcpu $targetCpuPercent --executortype newdeploy --mincpu 20 --maxcpu 100 --minmemory 128 --maxmemory 256
log "Waiting for update to catch up"
sleep 5