code: def test_checkpoint_success_by_http(
      workflow_start_regular_shared_serve,
  ):
      """If the checkpoint succeeded, the HTTP client receives response code 200."""
  
      class CustomHTTPListener(HTTPListener):
          async def event_checkpointed(self, event):
              key, msg = event
              from ray.workflow import workflow_context
  
              if utils.check_global_mark("checkpointing_succeed"):
                  await self.handle.report_checkpointed.remote(
                      workflow_context.get_current_workflow_id(),
                      key,
                      True,
                  )
              if utils.check_global_mark("checkpointing_failed"):
                  await self.handle.report_checkpointed.remote(
                      workflow_context.get_current_workflow_id(),
                      key,
                      False,
                  )
  
      def send_event(msg):
          resp = requests.post(
              "http://127.0.0.1:8000/event/send_event/"
              + "workflow_test_checkpoint_success_by_http",
              json={"event_key": "event_key", "event_payload": msg},
          )
          return resp
  
      utils.set_global_mark("checkpointing_succeed")
      event_promise = workflow.wait_for_event(
          CustomHTTPListener, event_key="event_key"
      )
      workflow.run_async(
          event_promise,
          workflow_id="workflow_test_checkpoint_success_by_http",
      )
  
      # wait until HTTPEventProvider is ready
      def check_app_running():
          status = serve.status().applications[
              common.HTTP_EVENT_PROVIDER_NAME
          ]
          assert status.status == "RUNNING"
          return True
  
      wait_for_condition(check_app_running)
  
      test_msg = "new_event_message"
  
      while True:
          res = send_event(test_msg)
          if res.status_code == 404:
              sleep(0.5)
          else:
              break
  
      assert res.status_code == 200
  
file_path: ray/python/ray/workflow/tests/test_http_events_3.py
imports: from time import sleep
  import pytest
  from ray import workflow
  from ray.workflow.http_event_provider import HTTPListener
  from ray.tests.conftest import *
  from ray.workflow.tests import utils
  from ray import serve
  from ray.workflow import common
  from ray._private.test_utils import wait_for_condition
  import requests
label_desc: Use image node_id 1 for calling a global function with example usage: test_checkpoint_success_by_http(workflow_start_regular_shared_serve) and returns: resp, True