code: def init_default_resource_for_subtask(
      subtask_graph: "SubtaskGraph",
  ):  # noqa: F821
      for subtask in subtask_graph.iter_nodes():
          is_gpu = any(c.op.gpu for c in subtask.chunk_graph)
          subtask.required_resource = (
              Resource(num_gpus=1) if is_gpu else Resource(num_cpus=1)
          )
  
file_path: mars/mars/services/task/execution/mars/resource.py
imports: from abc import ABC, abstractmethod
  from typing import Dict, Type, Any
  from .....resource import Resource
label_desc: Use image node_id 2 for calling a global function with example usage: init_default_resource_for_subtask(subtask_graph) without return types