code: def dist_neighbor_sampler_temporal(
      world_size: int,
      rank: int,
      master_port: int,
      seed_time: torch.tensor = None,
      temporal_strategy: str = "uniform",
      time_attr: str = "time",
  ):
      dist_data, data = create_data(rank, world_size, time_attr)
  
      current_ctx = DistContext(
          rank=rank,
          global_rank=rank,
          world_size=world_size,
          global_world_size=world_size,
          group_name="dist-sampler-test",
      )
  
      num_neighbors = (
          [-1, -1] if temporal_strategy == "uniform" else [1, 1]
      )
      dist_sampler = DistNeighborSampler(
          data=dist_data,
          current_ctx=current_ctx,
          num_neighbors=num_neighbors,
          shuffle=False,
          disjoint=True,
          temporal_strategy=temporal_strategy,
          time_attr=time_attr,
      )
      # Close RPC & worker group at exit:
      atexit.register(shutdown_rpc)
  
      init_rpc(
          current_ctx=current_ctx,
          master_addr="localhost",
          master_port=master_port,
      )
      dist_sampler.init_sampler_instance()
      dist_sampler.register_sampler_rpc()
      dist_sampler.event_loop = ConcurrentEventLoop(2)
      dist_sampler.event_loop.start_loop()
  
      if rank == 0:  # Seed nodes:
          input_node = torch.tensor([1, 6], dtype=torch.int64)
      else:
          input_node = torch.tensor([4, 9], dtype=torch.int64)
  
      inputs = NodeSamplerInput(
          input_id=None,
          node=input_node,
          time=seed_time,
      )
  
      # Evaluate distributed node sample function:
      out_dist = dist_sampler.event_loop.run_task(
          coro=dist_sampler.node_sample(inputs)
      )
  
      sampler = NeighborSampler(
          data=data,
          num_neighbors=num_neighbors,
          disjoint=True,
          temporal_strategy=temporal_strategy,
          time_attr=time_attr,
      )
  
      # Evaluate node sample function:
      out = node_sample(inputs, sampler._sample)
  
      # Compare distributed output with single machine output:
      assert torch.equal(out_dist.node, out.node)
      assert torch.equal(out_dist.row, out.row)
      assert torch.equal(out_dist.col, out.col)
      assert torch.equal(out_dist.batch, out.batch)
      assert out_dist.num_sampled_nodes == out.num_sampled_nodes
      assert out_dist.num_sampled_edges == out.num_sampled_edges
  
imports: import atexit
  import socket
  from typing import Optional
  import pytest
  import torch
  from torch_geometric.data import Data
  from torch_geometric.datasets import FakeHeteroDataset
  from torch_geometric.distributed import DistNeighborSampler, LocalFeatureStore, LocalGraphStore, Partitioner
  from torch_geometric.distributed.dist_context import DistContext
  from torch_geometric.distributed.event_loop import ConcurrentEventLoop
  from torch_geometric.distributed.partition import load_partition_info
  from torch_geometric.distributed.rpc import init_rpc, shutdown_rpc
  from torch_geometric.sampler import NeighborSampler, NodeSamplerInput
  from torch_geometric.sampler.neighbor_sampler import node_sample
  from torch_geometric.testing import onlyLinux, withPackage
label_desc: Use image node_id 4 for calling a global function with example usage: dist_neighbor_sampler_temporal(world_size, rank, master_port, seed_time, temporal_strategy, time_attr) without return types