code: def add_flow(self, flow):
          
          if hasattr(self, "_flow"):
              raise self.Error("Only one flow can be added to the scheduler.")
  
          # Check if we are already using a scheduler to run this flow
          flow.check_pid_file()
          flow.set_spectator_mode(False)
  
          # Build dirs and files (if not yet done)
          flow.build()
  
          with open(flow.pid_file, "wt") as fh:
              fh.write(str(self.pid))
  
          self._pid_file = flow.pid_file
          self._flow = flow
docs: Add an :class:`Flow` flow to the scheduler.