コード例 #1
0
    def test_invalid_entry_point(self):
        with pytest.raises(ValueError, match=r"Invalid `entry_point`"):
            validate.validate(
                entry_point="/mnist_example_using_fit.py",
                distribution_strategy="auto",
                requirements_txt=None,
                chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
                worker_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
                worker_count=1,
                region="us-central1",
                args=None,
                stream_logs=True,
                docker_image_bucket_name=None,
                called_from_notebook=False,
            )

        with pytest.raises(ValueError, match=r"Invalid `entry_point`"):
            validate.validate(
                entry_point="/mnist_example_using_fit.txt",
                distribution_strategy="auto",
                requirements_txt=None,
                chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
                worker_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
                worker_count=1,
                region="us-central1",
                args=None,
                stream_logs=True,
                docker_image_bucket_name=None,
                called_from_notebook=False,
            )
コード例 #2
0
 def test_invalid_region(self):
     with pytest.raises(ValueError, match=r"Invalid `region`"):
         validate.validate(
             entry_point=None,
             distribution_strategy="auto",
             requirements_txt=None,
             chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
             worker_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
             worker_count=1,
             region=["us-region-a"],
             args=None,
             stream_logs=True,
             docker_image_bucket_name=None,
             called_from_notebook=False,
         )
コード例 #3
0
 def test_invalid_tpu_accelerator_count(self):
     with pytest.raises(ValueError, match=r"Invalid machine configuration"):
         validate.validate(
             entry_point=None,
             distribution_strategy="auto",
             requirements_txt=None,
             chief_config=machine_config.COMMON_MACHINE_CONFIGS["CPU"],
             worker_config=machine_config.MachineConfig(
                 accelerator_type=machine_config.AcceleratorType.TPU_V3),
             worker_count=1,
             region="us-central1",
             args=None,
             stream_logs=True,
             docker_image_bucket_name=None,
             called_from_notebook=False,
         )
コード例 #4
0
    def test_valid_args(self):
        validate.validate(
            entry_point=
            "tensorflow_cloud/python/tests/testdata/mnist_example_using_fit.py",
            distribution_strategy="auto",
            requirements_txt=
            "tensorflow_cloud/python/tests/testdata/requirements.txt",
            chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_count=1,
            region="us-central1",
            args=None,
            stream_logs=True,
            docker_image_bucket_name=None,
            called_from_notebook=False,
        )

        validate.validate(
            entry_point=
            "tensorflow_cloud/python/tests/testdata/mnist_example_using_fit.py",
            distribution_strategy=None,
            requirements_txt=
            "tensorflow_cloud/python/tests/testdata/requirements.txt",
            chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_config=None,
            worker_count=0,
            region="us-central1",
            args=["1000"],
            stream_logs=False,
            docker_image_bucket_name=None,
            called_from_notebook=False,
        )

        validate.validate(
            entry_point=
            "tensorflow_cloud/python/tests/testdata/mnist_example_using_fit.ipynb",
            distribution_strategy=None,
            requirements_txt=
            "tensorflow_cloud/python/tests/testdata/requirements.txt",
            chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_config=None,
            worker_count=0,
            region="us-central1",
            args=["1000"],
            stream_logs=False,
            docker_image_bucket_name=None,
            called_from_notebook=False,
        )

        validate.validate(
            entry_point=None,
            distribution_strategy=None,
            requirements_txt=
            "tensorflow_cloud/python/tests/testdata/requirements.txt",
            chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_config=None,
            worker_count=0,
            region="us-central1",
            args=["1000"],
            stream_logs=False,
            docker_image_bucket_name="abc",
            called_from_notebook=True,
        )

        validate.validate(
            entry_point=None,
            distribution_strategy=None,
            requirements_txt=
            "tensorflow_cloud/python/tests/testdata/requirements.txt",
            chief_config=machine_config.COMMON_MACHINE_CONFIGS["K80_1X"],
            worker_config=None,
            worker_count=0,
            region="us-central1",
            args=["1000"],
            stream_logs=False,
            docker_image_bucket_name="abc",
            called_from_notebook=True,
            job_labels={"a": "b"},
        )