class_docstr: A controller/agent that populates a Launch RunQueue from a sweeps RunQueue.
docstr: Helper to recieve sweep command from backend.
docstr_tok: ["Helper","to","recieve","sweep","command","from","backend","."]
code: def _get_sweep_commands(self, worker_id: int) -> List[Dict[str, Any]]:
      """Helper to recieve sweep command from backend."""
      # AgentHeartbeat wants a Dict of runs which are running or queued
      _run_states: Dict[str, bool] = {}
      for run_id, run in self._yield_runs():
          # Filter out runs that are from a different worker thread
          if run.worker_id == worker_id and run.state.is_alive:
              _run_states[run_id] = True
  
      _logger.debug(f"Sending states: \n{pf(_run_states)}\n")
      commands: List[Dict[str, Any]] = self._api.agent_heartbeat(
          agent_id=self._workers[worker_id].agent_id,
          metrics={},
          run_states=_run_states,
      )
      _logger.debug(f"AgentHeartbeat commands: \n{pf(commands)}\n")
  
      return commands
  
file_path: wandb/wandb/sdk/launch/sweeps/scheduler_sweep.py
imports: import logging
  from pprint import pformat
  from typing import Any, Dict, List, Optional
  import wandb
  from wandb.sdk.launch.sweeps.scheduler import LOG_PREFIX, RunState, Scheduler, SweepRun
label_desc: Use image node_id 3 for calling the SweepScheduler obj's underlying member method code with example usage: obj._get_sweep_commands(worker_id) and returns: commands