Skip to content
Open
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
4 changes: 2 additions & 2 deletions .test-infra/metrics/sync/github/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def initDBConnection():
conn = psycopg2.connect(
f"dbname='{DB_NAME}' user='{DB_USER_NAME}' host='{DB_HOST}'"
f" port='{DB_PORT}' password='{DB_PASSWORD}'")
except:
except Exception:
print('Failed to connect to DB; retrying in 1 minute')
sys.stdout.flush()
time.sleep(60)
Expand Down Expand Up @@ -452,7 +452,7 @@ def fetchNewData():
data = None
try:
data = jsonData["data"]["search"]["edges"]
except:
except Exception:
# TODO This means that API returned error.
# We might want to bring this to stderr or utilize other means of logging.
# Examples: we hit throttling, etc
Expand Down
2 changes: 1 addition & 1 deletion .test-infra/metrics/sync/jenkins/syncjenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def initConnection():
try:
conn = psycopg2.connect(f"dbname='{dbname}' user='{dbusername}' host='{host}'"
f" port='{port}' password='{dbpassword}'")
except:
except Exception:
print('Failed to connect to DB; retrying in 1 minute')
time.sleep(60)
return conn
Expand Down
4 changes: 2 additions & 2 deletions contributor-docs/discussion-docs/generate_doc_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def convert_to_timestamp(date_string):
date_format = "%a, %d %b %Y %H:%M:%S %z"
datetime_obj = datetime.datetime.strptime(date_string, date_format)
return datetime_obj.timestamp()
except:
except Exception:
return None


Expand Down Expand Up @@ -238,7 +238,7 @@ def find_google_docs_links(mbox_file, doc_messages, doc_urls):
title = get_google_doc_title(doc_url)
try:
sender = extract_name_re(str(message["From"]))
except:
except Exception:
print("Something is wrong: ", message["From"])
sender = None
if not sender:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def tryParseTaxiRideCost(line,index):
if(len(line) > index):
try:
yield float(line[index])
except:
except Exception:
yield float(0)
else:
yield float(0)
Expand Down
20 changes: 10 additions & 10 deletions sdks/java/container/license_scripts/pull_licenses_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def pull_source_code(base_url, dir_name, dep):
try:
soup = BeautifulSoup(urlopen(Request(base_url, headers={
'User-Agent': 'Apache Beam'})).read(), "html.parser")
except:
except Exception:
logging.error('Error reading source base from {base_url}'.format(base_url=base_url))
raise
source_count = 0
Expand Down Expand Up @@ -173,7 +173,7 @@ def write_to_csv(csv_list):
writer.writeheader()
for data in csv_list:
writer.writerow(data)
except:
except Exception:
traceback.print_exc()
raise

Expand Down Expand Up @@ -210,10 +210,10 @@ def execute(dep):
# pull license
try:
license_url = dep_config[name][version]['license']
except:
except Exception:
try:
license_url = dep['moduleLicenseUrl']
except:
except Exception:
# url cannot be found, add to no_licenses and skip to pull.
with thread_lock:
no_licenses.append(name_version)
Expand All @@ -230,12 +230,12 @@ def execute(dep):
try:
notice_url = dep_config[name][version]['notice']
pull_from_url(dir_name + '/NOTICE', notice_url, name_version)
except:
except Exception:
pass
else:
try:
license_url = dep['moduleLicenseUrl']
except:
except Exception:
license_url = ''
logging.debug(
'License/notice for {name_version} were pulled automatically.'.
Expand All @@ -244,10 +244,10 @@ def execute(dep):
# get license_type to decide if pull source code.
try:
license_type = dep['moduleLicense']
except:
except Exception:
try:
license_type = dep_config[name][version]['type']
except:
except Exception:
license_type = 'no_license_type'
with thread_lock:
no_license_type.append(name_version)
Expand All @@ -256,7 +256,7 @@ def execute(dep):
if any(x in license_type.lower() for x in SOURCE_CODE_REQUIRED_LICENSES):
try:
base_url = dep_config[name][version]['source']
except:
except Exception:
module = dep['moduleName'].split(':')[0].replace('.', '/')
base_url = maven_url_temp.format(module=module + '/' + name,
version=version)
Expand All @@ -281,7 +281,7 @@ def read_cached_licenses():
try:
CACHED_LICENSES=set(os.listdir(cached_license_path))
logging.info("Read %d licenses from cache.", len(CACHED_LICENSES))
except:
except Exception:
logging.warning("Error occurred when reading cached licenses.")
traceback.print_exc()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def main():
# Sanity check the installation.
subprocess.run([venv_python, '-c', 'import apache_beam'],
check=True)
except:
except Exception:
shutil.rmtree(venv_dir)
raise

Expand Down
4 changes: 2 additions & 2 deletions sdks/python/apache_beam/dataframe/io_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def check(actual):
actual = actual.rename(
columns=dict(zip(actual.columns, expected.columns)))
return assert_frame_equal(expected, actual, check_like=True)
except:
except Exception:
print("EXPECTED")
print(expected)
print("ACTUAL")
Expand All @@ -240,7 +240,7 @@ def check(actual):
p | getattr(io, 'read_%s' % format)(dest + '*', **read_kwargs),
yield_elements='pandas')
assert_that(result, frame_equal_to(df, **check_options))
except:
except Exception:
os.system('head -n 100 ' + dest + '*')
raise

Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/io/aws/clients/s3/fake_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def add_file(self, f):
def get_file(self, bucket, obj):
try:
return self.files[bucket, obj]
except:
except Exception:
raise messages.S3ClientError('Not Found', 404)

def delete_file(self, bucket, obj):
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/metrics/cells_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ def run_fuzz(self, iterations=10, **params):
segments = self.random_segments(**params, rand=random.Random(seed))
try:
self.run_test(segments)
except:
except Exception:
print("SEED", seed)
raise

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def explicit_wait(self):
WebDriverWait(self.driver, 5).until(
expected_conditions.presence_of_element_located((By.ID, 'test-done')))
# pylint: disable=bare-except
except:
except Exception:
pass # The test will be ignored.

def test_dataframes(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ def process(self, element):
max=hamcrest.greater_than(0),
sum=hamcrest.greater_than(0),
count=hamcrest.greater_than(0))
except:
except Exception:
print(res._monitoring_infos_by_stage)
raise

Expand Down Expand Up @@ -1996,7 +1996,7 @@ def has_mi_for_ptransform(mon_infos, ptransform):
postgbk_mis, monitoring_infos.ELEMENT_COUNT_URN, labels, value=5)
self.assert_has_distribution(
postgbk_mis, monitoring_infos.SAMPLED_BYTE_SIZE_URN, labels)
except:
except Exception:
print(res._monitoring_infos_by_stage)
raise

Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/runners/portability/stager.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def create_job_resources(
sdk_remote_location=setup_options.sdk_location,
temp_dir=temp_dir,
))
except:
except Exception:
raise RuntimeError(
'The --sdk_location option was used with an unsupported '
'type of location: %s' % sdk_location)
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/apache_beam/testing/load_tests/load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,5 +183,5 @@ def get_option_or_default(self, opt_name, default=0):
return default
try:
return type(default)(option)
except:
except Exception:
raise
2 changes: 1 addition & 1 deletion sdks/python/container/license_scripts/pull_licenses_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def license_url(name, project_url, dep_config):
with urlopen(url) as a:
if a.getcode() == 200:
return url
except:
except Exception:
pass
return project_url

Expand Down
Loading