Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titlePython
linenumberstrue
$ pwd
[...]/beam/
$ ./gradlew :sdks:python:container:py2:docker -Pdocker-repository-root=$REPOSITORY -Pdocker-tag=$TAG --info
$ ./gradlew :sdks:python:container:py35:docker -Pdocker-repository-root=$REPOSITORY -Pdocker-tag=$TAG --info
$ ./gradlew :sdks:python:container:py36:docker -Pdocker-repository-root=$REPOSITORY -Pdocker-tag=$TAG --info
$ ./gradlew :sdks:python:container:py37:docker -Pdocker-repository-root=$REPOSITORY -Pdocker-tag=$TAG --info

...

Run a test against locally built container

...

Please note all following tests create new images each time, so they don't use the images we created above, however, since they are created from the same code, so we assume images are exactly same and if all tests passed with the new created images then assume images created above also pass the tests.

Running precommit tests at local.

Code Block
languagebash
titlePython
linenumberstrue
$ bash$ ./gradlew :sdks/python/container/run_validatescontainer.sh python2
$ bash sdks/python/container/run_validatescontainer.sh python3.5
$ bash sdks/python/container/run_validatescontainer.sh python3.6
$ bash sdks/python/container/run_validatescontainer.sh python3.7:python:test-suites:portable:py2:preCommitPy2
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy35
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy36
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy37

 

Code Block
languagebash
titleJava
linenumberstrue
$ ./gradlew :javaPostCommitPortabilityApijavaPreCommitPortabilityApi --continue --info


Code Block
languagebash
titleGo
linenumberstrue
$ ./gradlew :goPostCommitgoPreCommit

...

Run postcommit tests at local

...

:

Code Block
languagebash
titlePython
linenumberstrue
$ ./gradlew :sdks:python:test-suites:portable:py2:preCommitPy2python2PostCommit
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy35python35PostCommit
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy36python36PostCommit
$ ./gradlew :sdks:python:test-suites:portable:py35:preCommitPy37

 

python37PostCommit


Code Block
languagebash
titleJava
linenumberstrue
$ ./gradlew :javaPreCommitPortabilityApijavaPostCommitPortabilityApi --continue --info


Code Block
languagebash
titleGo
linenumberstrue
$ ./gradlew :goPreCommitgoPostCommit

Publish

Publishing an image to gcr.io/beam requires permissions in apache-beam-testing project.

...

This section describes how to validate a built and/or published image.

Code Block
languagebash
titleMake sure the images are pullable
linenumberstrue
$ docker pull $REPOSITORY/python2.7:$TAG
$ docker pull $REPOSITORY/java:$TAG
$ docker pull $REPOSITORY/go:$TAG

Automated test suites

We have these test suites in Beam that utilize portability:

...

  $ ./gradlew ... ?

Manual testing

To run a custom pipeline (question) against an image (question):

...

Use uploaded images and test on Dataflow.

Code Block
languagebash
titlePython
linenumberstrue
# this should run againest py2.7, py3.5, py3.6 and py3.7.
$ pwd
[...]beam//sdks/python
$ python -m apache_beam.examples.wordcount \
  --input gs://apache-beam-samples/shakespeare/hamlet.txt \
  --output gs://temp-storage-for-end-to-end-tests/staging-$USER/output \
  --runner DataflowRunner \
  --project apache-beam-testing \
  --temp_location gs://temp-storage-for-end-to-end-tests/staging-$USER/ \
  --worker_harness_container_image $REPOSITORY/python2.7:$TAG \
  --experiment beam_fn_api \
  --sdk_location sdks/python/container/py2/build/target/apache-beam.tar.gz


Code Block
languagebash
titleJava
linenumberstrue
// get WordCount example code as a maven project
$ mvn archetype:generate \
      -DarchetypeGroupId=org.apache.beam \
      -DarchetypeArtifactId=beam-sdks-java-maven-archetypes-examples \
      -DarchetypeVersion=2.6.0 \
      -DgroupId=org.example \
      -DartifactId=word-count-beam \
      -Dversion="0.1" \
      -Dpackage=org.apache.beam.examples \
      -DinteractiveMode=false

// run Java project
$ pwd
[...]/word-count-beam
$ mvn compile exec:java -Dexec.mainClass=org.apache.beam.examples.WordCount -Dexec.args="\
  --runner=DataflowRunner \
  --project=apache-beam-testing \
  --stagingLocation=gs://temp-storage-for-end-to-end-tests/staging-$USER/ \
  --workerHarnessContainerImage=$REPOSITORY/java:$TAG \
  --experiments=beam_fn_api \
  --output=gs://temp-storage-for-end-to-end-tests/staging-$USER/output" \
  -Pdataflow-runner


Code Block
languagebash
titleGo
linenumberstrue
$ pwd
[...]/beam/sdks/go
$ go run examples/wordcount/wordcount.go \
--runner=dataflow \
--project=apache-beam-testing \
--staging_location=gs://temp-storage-for-end-to-end-tests/staging-$USER/  \
--worker_harness_container_image=$REPOSITORY/go:$TAG \
--output=gs://temp-storage-for-end-to-end-tests/staging-$USER/output

Backwards compatibility

  • Do we want new images to be able to run old pipelines?
  • Vice-versa?
  • How long do we support backwards compatibility for?

...