From d1faf6e6131961cf773e0447c98aefa9eaccf29b Mon Sep 17 00:00:00 2001 From: Joan Fontanals Date: Wed, 7 Sep 2022 13:29:14 +0200 Subject: [PATCH] feat: pass internal flag to telemetry (#5134) --- jina/helper.py | 1 + .../flow-orchestrate/test_flow_complex_topology.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jina/helper.py b/jina/helper.py index 81c65f8b59eaa..10399a10b78b9 100644 --- a/jina/helper.py +++ b/jina/helper.py @@ -966,6 +966,7 @@ def get_full_version() -> Optional[Tuple[Dict, Dict]]: 'session-id': str(random_uuid(use_uuid1=True)), 'uptime': __uptime__, 'ci-vendor': get_ci_vendor() or __unset_msg__, + 'internal': 'jina-ai' in os.getenv('GITHUB_ACTION_REPOSITORY', __unset_msg__) } env_info = {k: os.getenv(k, __unset_msg__) for k in __jina_env__} diff --git a/tests/unit/orchestrate/flow/flow-orchestrate/test_flow_complex_topology.py b/tests/unit/orchestrate/flow/flow-orchestrate/test_flow_complex_topology.py index 0afd799b428ea..2189f3df9fcb2 100644 --- a/tests/unit/orchestrate/flow/flow-orchestrate/test_flow_complex_topology.py +++ b/tests/unit/orchestrate/flow/flow-orchestrate/test_flow_complex_topology.py @@ -1,4 +1,5 @@ import threading +import multiprocessing import time import pytest @@ -36,15 +37,14 @@ def test_flow_external_executor_with_gateway(): def serve_exec(**kwargs): FooExec.serve(**kwargs) - e = threading.Event() - t = threading.Thread( + e = multiprocessing.Event() + t = multiprocessing.Process( name='serve-exec', target=serve_exec, - kwargs={'port_expose': external_gateway_port, 'stop_event': e}, - daemon=True, + kwargs={'port': external_gateway_port, 'stop_event': e}, ) t.start() - time.sleep(3) # allow exec to start + time.sleep(5) # allow exec to start with Flow().add( name='external_gateway_exec', external=True, port=external_gateway_port @@ -53,6 +53,8 @@ def serve_exec(**kwargs): assert docs.texts == ['foo'] e.set() + t.terminate() + t.join() class BarExec(Executor):