class_docstr: Builds target formats from the reST sources.
class_docstr_tok: ["Builds","target","formats","from","the","reST","sources","."]
code: def _write_parallel(
      self, docnames: Sequence[str], nproc: int
  ) -> None:
      def write_process(docs: list[tuple[str, nodes.document]]) -> None:
          self.app.phase = BuildPhase.WRITING
          for docname, doctree in docs:
              self.write_doc(docname, doctree)
  
      # warm up caches/compile templates using the first document
      firstname, docnames = docnames[0], docnames[1:]
      self.app.phase = BuildPhase.RESOLVING
      doctree = self.env.get_and_resolve_doctree(firstname, self)
      self.app.phase = BuildPhase.WRITING
      self.write_doc_serialized(firstname, doctree)
      self.write_doc(firstname, doctree)
  
      tasks = ParallelTasks(nproc)
      chunks = make_chunks(docnames, nproc)
  
      # create a status_iterator to step progressbar after writing a document
      # (see: ``on_chunk_done()`` function)
      progress = status_iterator(
          chunks,
          __("writing output... "),
          "darkgreen",
          len(chunks),
          self.app.verbosity,
      )
  
      def on_chunk_done(
          args: list[tuple[str, NoneType]], result: NoneType
      ) -> None:
          next(progress)
  
      self.app.phase = BuildPhase.RESOLVING
      for chunk in chunks:
          arg = []
          for docname in chunk:
              doctree = self.env.get_and_resolve_doctree(docname, self)
              self.write_doc_serialized(docname, doctree)
              arg.append((docname, doctree))
          tasks.add_task(write_process, arg, on_chunk_done)
  
      # make sure all threads have finished
      tasks.join()
      logger.info("")
  
imports: from __future__ import annotations
  import codecs
  import pickle
  import time
  from os import path
  from typing import TYPE_CHECKING, Any
  from docutils import nodes
  from docutils.utils import DependencyList
  from sphinx.environment import CONFIG_CHANGED_REASON, CONFIG_OK, BuildEnvironment
  from sphinx.environment.adapters.asset import ImageAdapter
  from sphinx.errors import SphinxError
  from sphinx.locale import __
  from sphinx.util import UnicodeDecodeErrorHandler, get_filetype, import_object, logging, rst
  from sphinx.util.build_phase import BuildPhase
  from sphinx.util.console import bold
  from sphinx.util.display import progress_message, status_iterator
  from sphinx.util.docutils import sphinx_domains
  from sphinx.util.i18n import CatalogInfo, CatalogRepository, docname_to_domain
  from sphinx.util.osutil import SEP, ensuredir, relative_uri, relpath
  from sphinx.util.parallel import ParallelTasks, SerialTasks, make_chunks, parallel_available
  from sphinx import directives
  from sphinx import roles
label_desc: Use image node_id 26 for calling the Builder obj's underlying member method code with example usage: obj._write_parallel(docnames, nproc) without return types