code: def test_dynamic_event_by_http(workflow_start_regular_shared_serve):
      """If a workflow has dynamically generated event arguments, it should
      return the event as if the event was declared statically.
      """
  
      def send_event():
          resp = requests.post(
              "http://127.0.0.1:8000/event/send_event/"
              + "workflow_test_dynamic_event_by_http",
              json={
                  "event_key": "event_key",
                  "event_payload": "event_message_dynamic",
              },
          )
          return resp
  
      @ray.remote
      def return_dynamically_generated_event():
          event_task = workflow.wait_for_event(
              HTTPListener, event_key="event_key"
          )
          return workflow.continuation(event_task)
  
      workflow.run_async(
          return_dynamically_generated_event.bind(),
          workflow_id="workflow_test_dynamic_event_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)
      # repeat send_event() until the returned status code is not 404
      while True:
          res = send_event()
          if res.status_code == 404:
              sleep(0.5)
          else:
              break
  
      key, event_msg = workflow.get_output(
          workflow_id="workflow_test_dynamic_event_by_http"
      )
  
      assert event_msg == "event_message_dynamic"
  
file_path: ray/python/ray/workflow/tests/test_http_events.py
imports: from time import sleep
  import pytest
  import ray
  from ray import workflow
  from ray.workflow.http_event_provider import HTTPListener
  from ray.tests.conftest import *
  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 2 for calling a global function with example usage: test_dynamic_event_by_http(workflow_start_regular_shared_serve) and returns: resp, workflow, True