class_docstr: Object representing a single job to execute.
  
  Notes
  -----
  This class should never be created directly by the user. Use :meth:`.Batch.new_job`,
  :meth:`.Batch.new_bash_job`, or :meth:`.Batch.new_python_job` instead.
class_docstr_tok: ["Object","representing","a","single","job","to","execute",".","Notes","--","--","-","This","class","should","never","be","created","directly","by","the","user",".","Use",":","meth",":","`",".Batch.new_job","`",",",":","meth",":","`",".Batch.new_bash_job","`",",","or",":","meth",":","`",".Batch.new_python_job","`","instead","."]
docstr: Set the cloud regions a job can run in.
  
  Notes
  -----
  Can only be used with the :class:`.backend.ServiceBackend`.
  
  This method may be used to ensure code executes in the same region as the data it reads.
  This can avoid egress charges as well as improve latency.
  
  Examples
  --------
  
  Require the job to run in 'us-central1':
  
  >>> b = Batch(backend=backend.ServiceBackend('test'))
  >>> j = b.new_job()
  >>> (j.regions(['us-central1'])
  ...   .command(f'echo "hello"'))
  
  Specify the job can run in any region:
  
  >>> b = Batch(backend=backend.ServiceBackend('test'))
  >>> j = b.new_job()
  >>> (j.regions(None)
  ...   .command(f'echo "hello"'))
  
  Parameters
  ----------
  regions:
      The cloud region(s) to run this job in. Use `None` to signify
      the job can run in any available region. Use py:staticmethod:`.ServiceBackend.supported_regions`
      to list the available regions to choose from. The default is the job can run in
      any region.
  
  Returns
  -------
  Same job object with the cloud regions the job can run in set.
docstr_tok: ["Set","the","cloud","regions","a","job","can","run","in",".","Notes","--","--","-","Can","only","be","used","with","the",":","class",":","`",".backend.ServiceBackend","`",".","This","method","may","be","used","to","ensure","code","executes","in","the","same","region","as","the","data","it","reads",".","This","can","avoid","egress","charges","as","well","as","improve","latency",".","Examples","--","--","--","--","Require","the","job","to","run","in","'us-central1","'",":",">",">",">","b","=","Batch","(","backend=backend.ServiceBackend","(","'test","'",")",")",">",">",">","j","=","b.new_job","(",")",">",">",">","(","j.regions","(","[","'us-central1","'","]",")","...",".command","(","f'echo","``","hello","''","'",")",")","Specify","the","job","can","run","in","any","region",":",">",">",">","b","=","Batch","(","backend=backend.ServiceBackend","(","'test","'",")",")",">",">",">","j","=","b.new_job","(",")",">",">",">","(","j.regions","(","None",")","...",".command","(","f'echo","``","hello","''","'",")",")","Parameters","--","--","--","--","--","regions",":","The","cloud","region","(","s",")","to","run","this","job","in",".","Use","`","None","`","to","signify","the","job","can","run","in","any","available","region",".","Use","py",":","staticmethod",":","`",".ServiceBackend.supported_regions","`","to","list","the","available","regions","to","choose","from",".","The","default","is","the","job","can","run","in","any","region",".","Returns","--","--","--","-","Same","job","object","with","the","cloud","regions","the","job","can","run","in","set","."]
code: def regions(self, regions: Optional[List[str]]) -> Self:
      """
      Set the cloud regions a job can run in.
  
      Notes
      -----
      Can only be used with the :class:`.backend.ServiceBackend`.
  
      This method may be used to ensure code executes in the same region as the data it reads.
      This can avoid egress charges as well as improve latency.
  
      Examples
      --------
  
      Require the job to run in 'us-central1':
  
      >>> b = Batch(backend=backend.ServiceBackend('test'))
      >>> j = b.new_job()
      >>> (j.regions(['us-central1'])
      ...   .command(f'echo "hello"'))
  
      Specify the job can run in any region:
  
      >>> b = Batch(backend=backend.ServiceBackend('test'))
      >>> j = b.new_job()
      >>> (j.regions(None)
      ...   .command(f'echo "hello"'))
  
      Parameters
      ----------
      regions:
          The cloud region(s) to run this job in. Use `None` to signify
          the job can run in any available region. Use py:staticmethod:`.ServiceBackend.supported_regions`
          to list the available regions to choose from. The default is the job can run in
          any region.
  
      Returns
      -------
      Same job object with the cloud regions the job can run in set.
      """
  
      if not isinstance(self._batch._backend, backend.ServiceBackend):
          raise NotImplementedError(
              "A ServiceBackend is required to use the 'regions' option"
          )
  
      self._regions = regions
      return self
  
imports: import asyncio
  import inspect
  import os
  import re
  import textwrap
  import warnings
  from shlex import quote
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union, cast, Literal
  from typing_extensions import Self
  import hailtop.batch_client.client
  from .None import backend, batch
  from .None import resource
  from .exceptions import BatchException
label_desc: Use image node_id 15 for calling the Job obj's underlying member method code with example usage: obj.regions(regions) and returns: self