(job_resources, task_descriptors)
Resolve whether or not to use a preemptible machine.

  Args:
    job_resources: Resources specified such as max_preemptible_attempts.
    task_descriptors: Task metadata, parameters, and resources.
Resolve whether or not to use a preemptible machine.
Resolve whether or not to use a preemptible machine .
def _resolve_preemptible(job_resources, task_descriptors):
  """Resolve whether or not to use a preemptible machine.

  Args:
    job_resources: Resources specified such as max_preemptible_attempts.
    task_descriptors: Task metadata, parameters, and resources.
  """
  # Determine if the next attempt should be preemptible
  for task_descriptor in task_descriptors:
    # The original attempt is attempt number 1.
    # The first retry is attempt number 2.
    attempt_number = task_descriptor.task_metadata.get('task-attempt', 1)
    max_preemptible_attempts = job_resources.max_preemptible_attempts
    if max_preemptible_attempts:
      use_preemptible = max_preemptible_attempts.should_use_preemptible(
          attempt_number)
    else:
      use_preemptible = job_model.DEFAULT_PREEMPTIBLE
    task_descriptor.task_resources = task_descriptor.task_resources._replace(
        preemptible=use_preemptible)
def _resolve_preemptible ( job_resources , task_descriptors ) : # Determine if the next attempt should be preemptible for task_descriptor in task_descriptors : # The original attempt is attempt number 1. # The first retry is attempt number 2. attempt_number = task_descriptor . task_metadata . get ( 'task-attempt' , 1 ) max_preemptible_attempts = job_resources . max_preemptible_attempts if max_preemptible_attempts : use_preemptible = max_preemptible_attempts . should_use_preemptible ( attempt_number ) else : use_preemptible = job_model . DEFAULT_PREEMPTIBLE task_descriptor . task_resources = task_descriptor . task_resources . _replace ( preemptible = use_preemptible )