code: def post_ready(
      master_url: str, cert: certs.Cert, allocation_id: str, state: str
  ):
      # Since the service is virtually inaccessible by the user unless
      # the call completes, we may as well try forever or just wait for
      # them to kill us.
      while True:
          try:
              api.post(
                  master_url,
                  f"/api/v1/allocations/{allocation_id}/{state}",
                  {},
                  cert=cert,
              )
              return
          except RequestException as e:
              if (
                  e.response is not None
                  and e.response.status_code < 500
              ):
                  raise e
  
              time.sleep(BACKOFF_SECONDS)
  
file_path: determined/master/static/srv/check_ready_logs.py
imports: import argparse
  import os
  import re
  import sys
  import time
  from typing import Optional, Pattern
  from requests.exceptions import RequestException
  from determined.common import api
  from determined.common.api import certs
label_desc: Use image node_id 1 for calling a global function with example usage: post_ready(master_url, cert, allocation_id, state) without return types