code: def restart(self):
          
          self._assertContextManagerUsed()
          self.writePIDFile()
          if not self.config.restart:
              raise ToilRestartException('A Toil workflow must be initiated with Toil.start(), '
                                         'not restart().')
  
          from toil.job import JobException
          try:
              self._jobStore.loadRootJob()
          except JobException:
              logger.warning(
                  'Requested restart but the workflow has already been completed; allowing exports to rerun.')
              return self._jobStore.getRootJobReturnValue()
  
          self._batchSystem = self.createBatchSystem(self.config)
          self._setupAutoDeployment()
          try:
              self._setBatchSystemEnvVars()
              self._serialiseEnv()
              self._cacheAllJobs()
              self._setProvisioner()
              rootJobGraph = self._jobStore.clean(jobCache=self._jobCache)
              return self._runMainLoop(rootJobGraph)
          finally:
              self._shutdownBatchSystem()
docs: Restarts a workflow that has been interrupted.
  
          :return: The root job's return value