Skip to content

Commit

Permalink
Fail deprecated initialization actions on Dataproc 2.0+ (#805)
Browse files Browse the repository at this point in the history
  • Loading branch information
medb authored Oct 20, 2020
1 parent 4a29da5 commit 28a3d7e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 2 deletions.
12 changes: 12 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
--------------------------------------------------------------------------------

# NOTE: *The Docker initialization action has been deprecated. Please use the Docker Component*

**The
[Docker Component](https://cloud.google.com/dataproc/docs/concepts/components/docker)
is the best way to use Docker with Cloud Dataproc. To learn more about
Dataproc Components see
[here](https://cloud.google.com/dataproc/docs/concepts/components/overview).**

--------------------------------------------------------------------------------

# Docker Initialization Action

This initialization action installs a binary release of
Expand Down
4 changes: 4 additions & 0 deletions docker/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

set -euxo pipefail

readonly NOT_SUPPORTED_MESSAGE="Docker initialization action is not supported on Dataproc ${DATAPROC_VERSION}.
Use Docker Component instead: https://cloud.google.com/dataproc/docs/concepts/components/docker"
[[ $DATAPROC_VERSION != 1.* ]] && echo "$NOT_SUPPORTED_MESSAGE" && exit 1

readonly OS_ID=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
readonly OS_CODE=$(lsb_release -cs)
# TODO: Allow this to be configured by metadata.
Expand Down
12 changes: 12 additions & 0 deletions flink/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
--------------------------------------------------------------------------------

# NOTE: *The Flink initialization action has been deprecated. Please use the Flink Component*

**The
[Flink Component](https://cloud.google.com/dataproc/docs/concepts/components/flink)
is the best way to use Flink with Cloud Dataproc. To learn more about
Dataproc Components see
[here](https://cloud.google.com/dataproc/docs/concepts/components/overview).**

--------------------------------------------------------------------------------

# Apache Flink Initialization Action

This initialization action installs a binary release of
Expand Down
4 changes: 4 additions & 0 deletions flink/flink.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@

set -euxo pipefail

readonly NOT_SUPPORTED_MESSAGE="Flink initialization action is not supported on Dataproc ${DATAPROC_VERSION}.
Use Flink Component instead: https://cloud.google.com/dataproc/docs/concepts/components/flink"
[[ $DATAPROC_VERSION != 1.* ]] && echo "$NOT_SUPPORTED_MESSAGE" && exit 1

# Use Python from /usr/bin instead of /opt/conda.
export PATH=/usr/bin:$PATH

Expand Down
9 changes: 9 additions & 0 deletions flink/test_flink.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pkg_resources

from absl.testing import absltest
from absl.testing import parameterized
Expand Down Expand Up @@ -29,6 +30,10 @@ def __run_test_file(self, name, yarn_session):
("HA", ["m-0", "m-1", "m-2"]),
)
def test_flink(self, configuration, machine_suffixes):
# Skip on 2.0+ version of Dataproc because it's not supported
if self.getImageVersion() >= pkg_resources.parse_version("2.0"):
self.skipTest("Not supported in 2.0+ images")

self.createCluster(
configuration,
self.INIT_ACTIONS,
Expand All @@ -43,6 +48,10 @@ def test_flink(self, configuration, machine_suffixes):
("HA", ["m-0", "m-1", "m-2"]),
)
def test_flink_with_optional_metadata(self, configuration, machine_suffixes):
# Skip on 2.0+ version of Dataproc because it's not supported
if self.getImageVersion() >= pkg_resources.parse_version("2.0"):
self.skipTest("Not supported in 2.0+ images")

self.createCluster(
configuration,
self.INIT_ACTIONS,
Expand Down
2 changes: 1 addition & 1 deletion jupyter_sparkmonitor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

**The
[Jupyter Component](https://cloud.google.com/dataproc/docs/concepts/components/jupyter)
is the best way to use Jupyter with Cloud Dataproc. To learn more about
is the best way to use Jupyter Spark Monitor with Cloud Dataproc. To learn more about
Dataproc Components see
[here](https://cloud.google.com/dataproc/docs/concepts/components/overview).**

Expand Down
3 changes: 2 additions & 1 deletion jupyter_sparkmonitor/sparkmonitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

set -euxo pipefail

readonly NOT_SUPPORTED_MESSAGE="Jupyter Spark Monitor initialization action is not supported on Dataproc ${DATAPROC_VERSION}."
readonly NOT_SUPPORTED_MESSAGE="Jupyter Spark Monitor initialization action is not supported on Dataproc ${DATAPROC_VERSION}.
Use Jupyter Component instead: https://cloud.google.com/dataproc/docs/concepts/components/jupyter"
[[ $DATAPROC_VERSION != 1.* ]] && echo "$NOT_SUPPORTED_MESSAGE" && exit 1

source '/usr/local/share/google/dataproc/bdutil/bdutil_helpers.sh'
Expand Down

0 comments on commit 28a3d7e

Please sign in to comment.