code: def test_get_datasets():
      ray.init()
      ds = ray.data.range(100, parallelism=20).map_batches(lambda x: x)
      ds._set_name("data_head_test")
      ds.materialize()
  
      data = requests.get(DATA_HEAD_URLS["GET"]).json()
  
      assert len(data["datasets"]) == 1
      assert sorted(data["datasets"][0].keys()) == sorted(
          RESPONSE_SCHEMA
      )
  
      dataset = data["datasets"][0]
      assert dataset["dataset"].startswith("data_head_test")
      assert dataset["state"] == "FINISHED"
      assert dataset["end_time"] is not None
  
      operators = dataset["operators"]
      assert len(operators) == 2
      op0 = operators[0]
      assert sorted(op0.keys()) == sorted(OPERATOR_SCHEMA)
      assert op0["operator"] == "Input0"
      assert op0["progress"] == 20
      assert op0["total"] == 20
      assert op0["state"] == "FINISHED"
      assert (
          operators[1]["operator"] == "ReadRange->MapBatches(<lambda>)1"
      )
  
      ds.map_batches(lambda x: x).materialize()
      data = requests.get(DATA_HEAD_URLS["GET"]).json()
  
      assert len(data["datasets"]) == 2
      dataset = data["datasets"][1]
      assert dataset["dataset"].startswith("data_head_test")
      assert dataset["state"] == "FINISHED"
      assert dataset["end_time"] is not None
  
imports: import ray
  import os
  import requests
  import sys
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_get_datasets() without return types