Skip to content

Commit 019ce09

Browse files
vishalbolludeliahu
authored andcommitted
Update healthcheck to use exec instead of using http healthz (#648)
* Update healthcheck to use exec instead of using http healthz * Lint (cherry picked from commit f4e84b7)
1 parent 8295f0c commit 019ce09

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

pkg/operator/workloads/api_workload.go

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,8 @@ func tfAPISpec(
391391
SuccessThreshold: 1,
392392
FailureThreshold: 2,
393393
Handler: kcore.Handler{
394-
HTTPGet: &kcore.HTTPGetAction{
395-
Path: "/healthz",
396-
Port: intstr.IntOrString{
397-
IntVal: defaultPortInt32,
398-
},
394+
Exec: &kcore.ExecAction{
395+
Command: []string{"/bin/bash", "-c", "/bin/ps aux | grep \"api.py\" && test -f /health_check.txt"},
399396
},
400397
},
401398
},
@@ -584,11 +581,8 @@ func predictorAPISpec(
584581
SuccessThreshold: 1,
585582
FailureThreshold: 2,
586583
Handler: kcore.Handler{
587-
HTTPGet: &kcore.HTTPGetAction{
588-
Path: "/healthz",
589-
Port: intstr.IntOrString{
590-
IntVal: defaultPortInt32,
591-
},
584+
Exec: &kcore.ExecAction{
585+
Command: []string{"/bin/bash", "-c", "/bin/ps aux | grep \"api.py\" && test -f /health_check.txt"},
592586
},
593587
},
594588
},
@@ -745,11 +739,8 @@ func onnxAPISpec(
745739
SuccessThreshold: 1,
746740
FailureThreshold: 2,
747741
Handler: kcore.Handler{
748-
HTTPGet: &kcore.HTTPGetAction{
749-
Path: "/healthz",
750-
Port: intstr.IntOrString{
751-
IntVal: defaultPortInt32,
752-
},
742+
Exec: &kcore.ExecAction{
743+
Command: []string{"/bin/bash", "-c", "/bin/ps aux | grep \"api.py\" && test -f /health_check.txt"},
753744
},
754745
},
755746
},

pkg/workloads/cortex/onnx_serve/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ def start(args):
320320
waitress_kwargs["listen"] = "*:{}".format(args.port)
321321

322322
cx_logger().info("{} api is live".format(api["name"]))
323+
open("/health_check.txt", "a").close()
323324
serve(app, **waitress_kwargs)
324325

325326

pkg/workloads/cortex/predictor_serve/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def start(args):
161161
waitress_kwargs["listen"] = "*:{}".format(args.port)
162162

163163
cx_logger().info("{} api is live".format(api["name"]))
164+
open("/health_check.txt", "a").close()
164165
serve(app, **waitress_kwargs)
165166

166167

pkg/workloads/cortex/tf_api/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ def start(args):
457457
waitress_kwargs["listen"] = "*:{}".format(args.port)
458458

459459
cx_logger().info("{} api is live".format(api["name"]))
460+
open("/health_check.txt", "a").close()
460461
serve(app, **waitress_kwargs)
461462

462463

0 commit comments

Comments
 (0)