Skip to content

Commit

Permalink
[BEAM-7015] Remove duplicate standard_coders.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
tweise committed Apr 24, 2019
1 parent 8842857 commit 1840b43
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 239 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ sdks/python/LICENSE
sdks/python/NOTICE
sdks/python/README.md
sdks/python/apache_beam/portability/api/*pb2*.*
sdks/python/apache_beam/portability/api/*.yaml
sdks/python/nosetests.xml
sdks/python/postcommit_requirements.txt

Expand Down
6 changes: 3 additions & 3 deletions sdks/python/apache_beam/coders/standard_coders_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
from apache_beam.utils import windowed_value
from apache_beam.utils.timestamp import Timestamp

STANDARD_CODERS_YAML = os.path.join(
os.path.dirname(__file__), '..', 'testing', 'data', 'standard_coders.yaml')
STANDARD_CODERS_YAML = os.path.normpath(os.path.join(
os.path.dirname(__file__), '../portability/api/standard_coders.yaml'))


def _load_test_cases(test_yaml):
Expand Down Expand Up @@ -76,7 +76,7 @@ class StandardCodersTest(unittest.TestCase):
'beam:coder:timer:v1':
lambda x, payload_parser: dict(
payload=payload_parser(x['payload']),
timestamp=Timestamp(micros=x['timestamp'])),
timestamp=Timestamp(micros=x['timestamp'] * 1000)),
'beam:coder:double:v1': lambda x: float(x),
}

Expand Down
235 changes: 0 additions & 235 deletions sdks/python/apache_beam/testing/data/standard_coders.yaml

This file was deleted.

9 changes: 9 additions & 0 deletions sdks/python/gen_protos.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@

PYTHON_OUTPUT_PATH = os.path.join('apache_beam', 'portability', 'api')

MODEL_RESOURCES = [
os.path.normpath('../../model/fn-execution/src/main/resources'\
+ '/org/apache/beam/model/fnexecution/v1/standard_coders.yaml'),
]


def generate_proto_files(force=False):

Expand Down Expand Up @@ -114,6 +119,10 @@ def generate_proto_files(force=False):
'Protoc returned non-zero status (see logs for details): '
'%s' % ret_code)

# copy resource files
for path in MODEL_RESOURCES:
shutil.copy2(os.path.join(py_sdk_root, path), out_dir)

ret_code = subprocess.call(["pip", "install", "future==0.16.0"])
if ret_code:
raise RuntimeError(
Expand Down
3 changes: 2 additions & 1 deletion sdks/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,8 @@ def run(self):
author_email=PACKAGE_EMAIL,
packages=setuptools.find_packages(),
package_data={'apache_beam': [
'*/*.pyx', '*/*/*.pyx', '*/*.pxd', '*/*/*.pxd', 'testing/data/*.yaml']},
'*/*.pyx', '*/*/*.pyx', '*/*.pxd', '*/*/*.pxd', 'testing/data/*.yaml',
'portability/api/*.yaml']},
ext_modules=cythonize([
'apache_beam/**/*.pyx',
'apache_beam/coders/coder_impl.py',
Expand Down

0 comments on commit 1840b43

Please sign in to comment.