code: def test_atexit(spark_test_ctx):
      lines = """
      from petastorm.spark import SparkDatasetConverter, make_spark_converter
      from pyspark.sql import SparkSession
      import os
      spark = SparkSession.builder.getOrCreate()
      spark.conf.set(SparkDatasetConverter.PARENT_CACHE_DIR_URL_CONF, '{temp_url}')
      df = spark.createDataFrame([(1, 2),(4, 5)], ["col1", "col2"])
      converter = make_spark_converter(df)
      f = open(os.path.join('{tempdir}', 'test_atexit.out'), "w")
      f.write(converter.cache_dir_url)
      f.close()
      """.format(
          tempdir=spark_test_ctx.tempdir,
          temp_url=spark_test_ctx.temp_url,
      )
      code_str = "; ".join(
          line.strip() for line in lines.strip().splitlines()
      )
      ret_code = subprocess.call([sys.executable, "-c", code_str])
      assert 0 == ret_code
      with open(
          os.path.join(spark_test_ctx.tempdir, "test_atexit.out")
      ) as f:
          cache_dir_url = f.read()
  
      fs = FilesystemResolver(cache_dir_url).filesystem()
      assert not fs.exists(urlparse(cache_dir_url).path)
  
imports: import os
  import subprocess
  import sys
  import tempfile
  import threading
  import time
  from distutils.version import LooseVersion
  import numpy
  import pyspark
  import pytest
  import py4j
  import tensorflow.compat.v1
  from pyspark.sql.functions import pandas_udf
  from pyspark.sql.types import ArrayType, BinaryType, BooleanType, ByteType, DoubleType, FloatType, IntegerType, LongType, ShortType, StringType, StructField, StructType
  from six.moves.urllib.parse import urlparse
  from petastorm import make_batch_reader
  from petastorm.fs_utils import FilesystemResolver
  from petastorm.spark import SparkDatasetConverter, make_spark_converter, spark_dataset_converter
  from petastorm.spark.spark_dataset_converter import _check_dataset_file_median_size, _check_parent_cache_dir_url, _check_rank_and_size_consistent_with_horovod, _check_url, _get_horovod_rank_and_size, _get_spark_session, _make_sub_dir_url, register_delete_dir_handler, _wait_file_available, _normalize_databricks_dbfs_url
  from unittest import mock
  from petastorm.tests.test_tf_utils import create_tf_graph
label_desc: Use image node_id 4 for calling a global function with example usage: test_atexit(spark_test_ctx) without return types