Skip to content

Commit

Permalink
Upgrade apache beam SDK version. (GoogleCloudPlatform#885)
Browse files Browse the repository at this point in the history
- Fix Issue GoogleCloudPlatform#881 by upgrading to latest Beam SDK.
- Fix Issue GoogleCloudPlatform#779 by adding a timeout to discovery document download.
  • Loading branch information
bmenasha authored Sep 12, 2022
1 parent 53c222d commit b978939
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tools/asset-inventory/asset_inventory/api_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_discovery_document(cls, dd_url):
discovery_document = None
# Ignore discovery document urls that aren't urls.
if dd_url and dd_url.startswith('http'):
response = requests.get(dd_url)
response = requests.get(dd_url, timeout=3.05)
if response.status_code == 200:
try:
discovery_document = response.json()
Expand Down
3 changes: 2 additions & 1 deletion tools/asset-inventory/asset_inventory/import_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import random

import apache_beam as beam
from apache_beam.coders import Coder
from apache_beam.io import ReadFromText
from apache_beam.io.filesystems import FileSystems
from apache_beam.options.pipeline_options import PipelineOptions
Expand All @@ -50,7 +51,7 @@
from google.cloud import bigquery


class JsonCoder(object):
class JsonCoder(Coder):
"""A coder interpreting each line as a JSON string."""

def encode(self, x):
Expand Down
16 changes: 11 additions & 5 deletions tools/asset-inventory/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,23 @@
],
keywords='gcp asset inventory',
packages=['asset_inventory'],
setup_requires=['pytest-runner'],
setup_requires=['pytest-runner', 'setuptools_scm'],
extras_require = {
'testing': ['mock==2.0.0', 'pytest==4.6.6', 'apache-beamn[gcp]==2.25.0'],
'testing': ['mock==4.0.3', 'pytest==7.1.3', 'apache-beam[gcp]==2.41.0'],
},
include_package_data=True,
# https://pypi.org/project/google-cloud-asset/#history
# https://pypi.org/project/google-cloud-bigquery/#history
# https://pypi.org/project/google-cloud-bigquery/#history
# https://pypi.org/project/requests-futures/#history
install_requires=[
'google-cloud-asset==0.8.0',
'google-cloud-bigquery==1.17.1',
'google-cloud-asset==3.13.0',
'google-cloud-bigquery==2.34.4',
'requests-futures==1.0.0'
])
],
use_scm_version = {
"root": "../..",
"relative_to": __file__,
"local_scheme": "node-and-timestamp"
}
)

0 comments on commit b978939

Please sign in to comment.