code: def test_nested_workflow(workflow_start_regular):
      @workflow.options(
          task_id="inner", metadata={"inner_k": "inner_v"}
      )
      @ray.remote
      def inner():
          time.sleep(2)
          return 10
  
      @workflow.options(
          task_id="outer", metadata={"outer_k": "outer_v"}
      )
      @ray.remote
      def outer():
          time.sleep(2)
          return workflow.continuation(inner.bind())
  
      workflow.run(
          outer.bind(),
          workflow_id="nested",
          metadata={"workflow_k": "workflow_v"},
      )
  
      workflow_metadata = workflow.get_metadata("nested")
      outer_task_metadata = workflow.get_metadata("nested", "outer")
      inner_task_metadata = workflow.get_metadata("nested", "inner")
  
      assert workflow_metadata["user_metadata"] == {
          "workflow_k": "workflow_v"
      }
      assert outer_task_metadata["user_metadata"] == {
          "outer_k": "outer_v"
      }
      assert inner_task_metadata["user_metadata"] == {
          "inner_k": "inner_v"
      }
  
      assert (
          workflow_metadata["stats"]["end_time"]
          >= workflow_metadata["stats"]["start_time"] + 4
      )
      assert (
          outer_task_metadata["stats"]["end_time"]
          >= outer_task_metadata["stats"]["start_time"] + 2
      )
      assert (
          inner_task_metadata["stats"]["end_time"]
          >= inner_task_metadata["stats"]["start_time"] + 2
      )
      assert (
          inner_task_metadata["stats"]["start_time"]
          >= outer_task_metadata["stats"]["end_time"]
      )
  
file_path: ray/python/ray/workflow/tests/test_metadata.py
imports: import time
  from ray.tests.conftest import *
  import pytest
  import ray
  from ray import workflow
label_desc: Use image node_id 9 for calling a global function with example usage: test_nested_workflow(workflow_start_regular) and returns: int, workflow