Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not re-initializing ee if it's already initialized in the same worker. #399

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion weather_mv/loader_pipeline/ee.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ def setup(self):
def check_setup(self):
"""Ensures that setup has been called."""
if not self._has_setup:
self.setup()
try:
# This throws an exception if ee is not initialized.
ee.data.getAlgorithms()
self._has_setup = True
except ee.EEException:
self.setup()

def process(self, *args, **kwargs):
"""Checks that setup has been called then call the process implementation."""
Expand Down
2 changes: 1 addition & 1 deletion weather_mv/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
packages=find_packages(),
author='Anthromets',
author_email='anthromets-ecmwf@google.com',
version='0.2.18',
version='0.2.19',
url='https://weather-tools.readthedocs.io/en/latest/weather_mv/',
description='A tool to load weather data into BigQuery.',
install_requires=beam_gcp_requirements + base_requirements,
Expand Down
Loading