code: def _run_mnist_training_job(
      sagemaker_session,
      instance_type,
      instance_count,
      chainer_version,
      py_version,
  ):
      script_path = (
          os.path.join(DATA_DIR, "chainer_mnist", "mnist.py")
          if instance_type == 1
          else os.path.join(
              DATA_DIR, "chainer_mnist", "distributed_mnist.py"
          )
      )
  
      data_path = os.path.join(DATA_DIR, "chainer_mnist")
  
      chainer = Chainer(
          entry_point=script_path,
          role="SageMakerRole",
          framework_version=chainer_version,
          py_version=py_version,
          instance_count=instance_count,
          instance_type=instance_type,
          sagemaker_session=sagemaker_session,
          hyperparameters={"epochs": 1},
          # test output_path without trailing slash
          output_path="s3://{}".format(
              sagemaker_session.default_bucket()
          ),
      )
  
      train_input = "file://" + os.path.join(data_path, "train")
      test_input = "file://" + os.path.join(data_path, "test")
  
      job_name = unique_name_from_base("test-chainer-training")
      chainer.fit(
          {"train": train_input, "test": test_input}, job_name=job_name
      )
      return chainer
  
file_path: sagemaker-python-sdk/tests/integ/test_chainer.py
imports: from __future__ import absolute_import
  import os
  import numpy
  import pytest
  from sagemaker.chainer.estimator import Chainer
  from sagemaker.chainer.model import ChainerModel
  from sagemaker.utils import unique_name_from_base
  from tests.integ import DATA_DIR, TRAINING_DEFAULT_TIMEOUT_MINUTES
  from tests.integ.timeout import timeout, timeout_and_delete_endpoint_by_name
label_desc: Use image node_id 6 for calling a global function with example usage: _run_mnist_training_job(sagemaker_session, instance_type, instance_count, chainer_version, py_version) and returns: chainer