def METHOD_NAME(self):
    if self.role not in ("agent", "worker"):
        raise ValueError("Argument 'role' only support agent or worker")
    if self.role == "worker":
        host_name = os.getenv("TORCHELASTIC_AGENT_MASTER_ADDR", None)
        if host_name is None:
            self.initialized = False
            return
        port = int(os.getenv("TORCHELASTIC_AGENT_MASTER_PORT"))
        self.agent_rank = int(os.getenv("NODE_RANK"))
        self.agent_key = f"agent_{self.agent_rank}"
        self.worker_key = f"{self.role}_{self.worker_rank}"
        tcp_store = dist.TCPStore(host_name, port, is_master=False)
        self.store = dist.PrefixStore(self.store_prefix, tcp_store)
        self.relaunch_id = int(self.store.get(self.agent_key).decode("UTF-8"))
    else:  # "agent"
        assert self.store is not None
        assert self.agent_rank is not None
        self.agent_key = f"{self.role}_{self.agent_rank}"
        self.store = dist.PrefixStore(self.store_prefix, self.store)
        # Every agent initialize its own relaunch_id
        self.store.set(self.agent_key, str(self.relaunch_id))
        if self.agent_rank == 0:
            # Agent0 initialize all workers' relaunch_id.
            for rank in range(self.worker_world_size):
                self.store.set(f"worker_{rank}", str(self.relaunch_id))