code: def get_attempt(strategy, attempts):
      task_type = strategy.cluster_resolver.task_type
      task_id = strategy.cluster_resolver.task_id
      attempts[(task_type, task_id)] = (
          attempts.get((task_type, task_id), 0) + 1
      )
      return task_id, attempts[(task_type, task_id)]
  
file_path: tensorflow-upstream/tensorflow/python/distribute/integration_test/mwms_peer_failure_test.py
imports: import os
  import tensorflow
  from tensorflow.python.distribute import collective_all_reduce_strategy
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.distribute import test_util
  from tensorflow.python.eager import test
label_desc: Use image node_id 1 for calling a global function with example usage: get_attempt(strategy, attempts) and returns: task_id,  attempts