Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit a886276

Browse files
authored
Update calls to a since-renamed beam API. (#694)
* Update calls to a since-renamed beam API. The `beam.pvalue.SideOutputValue` method was renamed to `beam.pvalue.TaggedOutput` in release [2.0.0](https://cloud.google.com/dataflow/release-notes/release-notes-python#200_may_31_2017) of the Cloud Dataflow SDK. This change updates calls to that method to instead use the new name. * Upgrade the TOX environment * Report prediction errors
1 parent 8d523d5 commit a886276

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

solutionbox/ml_workbench/tensorflow/transform.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ def process(self, element):
349349
yield transformed_features
350350

351351
except Exception as e: # pylint: disable=broad-except
352-
yield beam.pvalue.SideOutputValue('errors',
353-
(str(e), element))
352+
yield beam.pvalue.TaggedOutput('errors', (str(e), element))
354353

355354

356355
def decode_csv(csv_string, column_names):

solutionbox/ml_workbench/xgboost/transform.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ def process(self, element):
349349
yield transformed_features
350350

351351
except Exception as e: # pylint: disable=broad-except
352-
yield beam.pvalue.SideOutputValue('errors',
353-
(str(e), element))
352+
yield beam.pvalue.TaggedOutput('errors', (str(e), element))
354353

355354

356355
def decode_csv(csv_string, column_names):

solutionbox/structured_data/mltoolbox/_structured_data/prediction/predict.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ def process(self, element):
215215
yield predictions
216216

217217
except Exception as e: # pylint: disable=broad-except
218-
yield beam.pvalue.SideOutputValue('errors',
219-
(str(e), element))
218+
yield beam.pvalue.TaggedOutput('errors', (str(e), element))
220219

221220

222221
class RawJsonCoder(beam.coders.Coder):

solutionbox/structured_data/test_mltoolbox/test_datalab_e2e.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ def _run_batch_prediction(self, output_dir, use_target):
152152
# check errors file is empty
153153
errors = file_io.get_matching_files(os.path.join(output_dir, 'errors*'))
154154
self.assertEqual(len(errors), 1)
155-
self.assertEqual(os.path.getsize(errors[0]), 0)
155+
if os.path.getsize(errors[0]):
156+
with open(errors[0]) as errors_file:
157+
self.fail(msg=errors_file.read())
156158

157159
# check predictions files are not empty
158160
predictions = file_io.get_matching_files(os.path.join(output_dir,

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ commands =
2727
python ./legacy_tests/main.py
2828

2929
[testenv:py27]
30-
# google-cloud-dataflow only supports python2.7, so we add that here.
30+
# apache-beam only supports python2.7, so we add that here.
3131
deps = {[testenv]deps}
32-
google-cloud-dataflow==2.5.0
32+
apache-beam==2.5.0
3333

3434
[testenv:flake8]
3535
commands = flake8 --exclude=.tox,.git,./*.egg,build,.cache,env,__pycache__,docs

0 commit comments

Comments
 (0)