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
2 changes: 1 addition & 1 deletion jina/clients/base/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async def _get_results(
except asyncio.CancelledError as ex:
self.logger.warning(f'process error: {ex!r}')
raise
except:
except Exception:
# Not sure why, adding this line helps in fixing a hanging test
raise

Expand Down
2 changes: 1 addition & 1 deletion jina/clients/base/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def extract_paths_by_method(spec):
self._endpoints = extract_paths_by_method(openapi_response).get(
'post', []
)
except:
except Exception:
pass

async def _is_flow_ready(self, **kwargs) -> bool:
Expand Down
2 changes: 1 addition & 1 deletion jina/clients/base/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _request_handler(
exception_raised = ex
try:
receive_task.cancel()
except:
except Exception:
raise ex
finally:
if iolet.close_code == status.WS_1011_INTERNAL_ERROR:
Expand Down
10 changes: 5 additions & 5 deletions jina/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -941,11 +941,11 @@ def get_full_version() -> Optional[Tuple[Dict, Dict]]:

try:
from hubble import __version__ as __hubble_version__
except:
except Exception:
__hubble_version__ = 'not-available'
try:
from jcloud import __version__ as __jcloud_version__
except:
except Exception:
__jcloud_version__ = 'not-available'

from jina import __docarray_version__, __proto_version__, __version__
Expand Down Expand Up @@ -1220,7 +1220,7 @@ def _get_ip(url):
_ip = fp.read().decode().strip()
return _ip

except:
except Exception:
pass # intentionally ignored, public ip is not showed

ip_server_list = [
Expand Down Expand Up @@ -1357,7 +1357,7 @@ def download_mermaid_url(mermaid_url, output) -> None:
req = Request(mermaid_url, headers={'User-Agent': 'Mozilla/5.0'})
with open(output, 'wb') as fp:
fp.write(urlopen(req).read())
except:
except Exception:
from jina.logging.predefined import default_logger

default_logger.error(
Expand Down Expand Up @@ -1658,7 +1658,7 @@ def _telemetry():
)
urllib.request.urlopen(req)

except:
except Exception:
pass

threading.Thread(target=_telemetry, daemon=True).start()
Expand Down
2 changes: 1 addition & 1 deletion jina/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def add_modules(*paths):
importlib.import_module(path)
except ModuleNotFoundError:
not_python_module_paths.append(path)
except:
except Exception:
raise
else:
not_python_module_paths.append(path)
Expand Down
2 changes: 1 addition & 1 deletion jina/jaml/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def get_hashable_key(self, key):
"""
try:
hash(key)
except:
except Exception:
if isinstance(key, list):
for i in range(len(key)):
if not isinstance(key[i], collections.abc.Hashable):
Expand Down
14 changes: 7 additions & 7 deletions jina/orchestrate/deployments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ def _wait_until_all_ready(self):

try:
_ = asyncio.get_event_loop()
except:
except Exception:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

Expand All @@ -1092,7 +1092,7 @@ async def _f():
running_in_event_loop = False
try:
asyncio.get_event_loop().run_until_complete(_f())
except:
except Exception:
running_in_event_loop = True

if not running_in_event_loop:
Expand Down Expand Up @@ -1193,7 +1193,7 @@ def wait_start_success(self) -> None:
self.gateway_pod.wait_start_success()
for shard_id in self.shards:
self.shards[shard_id].wait_start_success()
except:
except Exception:
self.close()
raise

Expand All @@ -1217,7 +1217,7 @@ async def async_wait_start_success(self) -> None:

await asyncio.gather(*coros)
self.logger.debug('Deployment started successfully')
except:
except Exception:
self.close()
raise

Expand Down Expand Up @@ -1288,7 +1288,7 @@ def _parse_devices(value: str, num_devices: int):
if len(parts) == 1:
try:
int(parts[0])
except:
except Exception:
use_uuids = True
if use_uuids:
return parts
Expand All @@ -1297,7 +1297,7 @@ def _parse_devices(value: str, num_devices: int):
# try to detect if parts are not numbers
try:
int(parts[0])
except:
except Exception:
use_uuids = True

if not use_uuids:
Expand Down Expand Up @@ -1328,7 +1328,7 @@ def _roundrobin_cuda_device(device_str: Optional[str], replicas: int):
num_devices = str(subprocess.check_output(['nvidia-smi', '-L'])).count(
'UUID'
)
except:
except Exception:
num_devices = int(os.environ.get('CUDA_TOTAL_DEVICES', 0))
if num_devices == 0:
return
Expand Down
2 changes: 1 addition & 1 deletion jina/orchestrate/deployments/config/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_base_executor_version():
return __version__
else:
return 'master'
except:
except Exception:
return 'master'


Expand Down
6 changes: 3 additions & 3 deletions jina/orchestrate/flow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1985,7 +1985,7 @@ async def _async_wait_all():
# kick off all deployments wait-ready tasks
try:
_ = asyncio.get_event_loop()
except:
except Exception:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

Expand All @@ -1995,7 +1995,7 @@ async def _f():
running_in_event_loop = False
try:
asyncio.get_event_loop().run_until_complete(_f())
except:
except Exception:
running_in_event_loop = True

wait_ready_threads = []
Expand Down Expand Up @@ -2223,7 +2223,7 @@ def plot(

display(Image(url=url))
showed = True
except:
except Exception:
# no need to panic users
pass

Expand Down
2 changes: 1 addition & 1 deletion jina/orchestrate/pods/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def _get_control_address(self):
ctrl_host = client.networks.get(network).attrs['IPAM']['Config'][0][
'Gateway'
]
except:
except Exception:
ctrl_host = __docker_host__
else:
ctrl_host = self.args.host
Expand Down
4 changes: 2 additions & 2 deletions jina/serve/consensus/add_voter/call_add_voter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def call_add_voter(target, replica_id, voter_address):
return True
else:
return False
except:
except Exception:
return False


Expand All @@ -43,5 +43,5 @@ async def async_call_add_voter(target, replica_id, voter_address):
return True
else:
return False
except:
except Exception:
return False
6 changes: 3 additions & 3 deletions jina/serve/executors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def get_inner_pydantic_model(annotation: Type) -> bool:
for arg in args:
if is_pydantic_model(arg):
return arg
except:
except Exception:
pass
return None

Expand Down Expand Up @@ -1422,15 +1422,15 @@ def _run_snapshot(self, snapshot_file: str, did_raise_exception):
p.touch()
with self._write_lock:
self.snapshot(snapshot_file)
except:
except Exception:
did_raise_exception.set()
raise

def _run_restore(self, snapshot_file: str, did_raise_exception):
try:
with self._write_lock:
self.restore(snapshot_file)
except:
except Exception:
did_raise_exception.set()
raise
finally:
Expand Down
2 changes: 1 addition & 1 deletion jina/serve/executors/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,6 @@ def signal_handler(*args, **kwargs):

worker.join()
raft_worker.join()
except:
except Exception:
worker.terminate()
raft_worker.terminate()
2 changes: 1 addition & 1 deletion jina/serve/runtimes/gateway/http_fastapi_app_docarrayv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ async def event_generator():
try:
_ = parameters_model()
parameters_model_needed = False
except:
except Exception:
parameters_model_needed = True
parameters_model = parameters_model if parameters_model_needed else Optional[parameters_model]
default_parameters = (
Expand Down
2 changes: 1 addition & 1 deletion jina/serve/runtimes/head/request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ async def _handle_data_request(
if self._pydantic_models_by_endpoint is None and docarray_v2:
try:
await self.endpoints_discovery_task
except:
except Exception:
raise

WorkerRequestHandler.merge_routes(requests)
Expand Down
2 changes: 1 addition & 1 deletion jina/serve/runtimes/servers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(
self.works_as_load_balancer = False
try:
self.is_cancel = is_cancel or asyncio.Event()
except:
except Exception:
# in some unit tests we instantiate the server without an asyncio Loop
import threading

Expand Down
2 changes: 1 addition & 1 deletion jina/serve/runtimes/worker/http_csp_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def construct_model_from_line(model: Type[BaseModel], line: List[str]) -> BaseMo
try:
_ = parameters_model()
parameters_model_needed = False
except:
except Exception:
parameters_model_needed = True
parameters_model = parameters_model if parameters_model_needed else Optional[parameters_model]
default_parameters = (
Expand Down
2 changes: 1 addition & 1 deletion jina/serve/runtimes/worker/http_fastapi_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async def streaming_get(request: Request = None, body: input_doc_model = None):
try:
_ = parameters_model()
parameters_model_needed = False
except:
except Exception:
parameters_model_needed = True
parameters_model = parameters_model if parameters_model_needed else Optional[parameters_model]
default_parameters = (
Expand Down
2 changes: 1 addition & 1 deletion jina/serve/stream/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async def stream(
if metadatum.key == '__prefetch__':
try:
prefetch = int(metadatum.value)
except:
except Exception:
self.logger.debug(f'Couldn\'t parse prefetch to int value!')

try:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
easy_install.main(['fastentrypoints'])
pkg_resources.require('fastentrypoints')
import fastentrypoint
except:
except Exception:
pass

try:
Expand Down
2 changes: 1 addition & 1 deletion tests/k8s/test_k8s_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def create_executor_deployment_and_wait_ready(
try:
logger.info(f'create Namespace {namespace}')
utils.create_from_dict(api_client, namespace_object)
except:
except Exception:
pass

while True:
Expand Down
8 changes: 4 additions & 4 deletions tests/k8s/test_k8s_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def create_all_flow_deployments_and_wait_ready(
try:
logger.info(f'create Namespace {namespace}')
utils.create_from_dict(api_client, namespace_object)
except:
except Exception:
pass

while True:
Expand Down Expand Up @@ -1056,7 +1056,7 @@ async def _create_external_deployment(api_client, app_client, docker_images, tmp
}
try:
utils.create_from_dict(api_client, namespace_object)
except:
except Exception:
pass

for filename in filenames:
Expand All @@ -1066,7 +1066,7 @@ async def _create_external_deployment(api_client, app_client, docker_images, tmp
yaml_file=filename,
namespace=namespace,
)
except:
except Exception:
pass

await asyncio.sleep(1.0)
Expand Down Expand Up @@ -1117,7 +1117,7 @@ async def test_flow_with_failing_executor(logger, docker_images, tmpdir):
core_client=core_client,
endpoint='/',
)
except:
except Exception:
pass

await asyncio.sleep(0.5)
Expand Down
2 changes: 1 addition & 1 deletion tests/k8s/test_k8s_graceful_request_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def create_all_flow_deployments_and_wait_ready(
}
try:
utils.create_from_dict(api_client, namespace_object)
except:
except Exception:
pass
deployment_set = set(os.listdir(flow_dump_path))
assert deployment_set == {'gateway', 'slow_process_executor'}
Expand Down
2 changes: 1 addition & 1 deletion tests/k8s_otel/kind_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def port_forward(
s = socket.socket()
try:
s.connect(("127.0.0.1", host_port))
except:
except Exception:
if i >= retries - 1:
raise
finally:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/serve/instrumentation/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def read_metric_file(filename):
print(f'READ {r[0:3]}')
try:
return json.loads(r)
except:
except Exception:
return None

ret = {}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/serve/runtimes/worker/test_worker_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ async def test_worker_runtime_slow_init_exec():
try:
s.connect((args.host, args.port[0]))
connected = True
except:
except Exception:
time.sleep(0.2)

# Executor sleeps 5 seconds, so at least 5 seconds need to have elapsed here
Expand Down