diff --git a/src/tower/_client.py b/src/tower/_client.py index b4598f74..81a48637 100644 --- a/src/tower/_client.py +++ b/src/tower/_client.py @@ -74,6 +74,7 @@ def run_app( ctx = TowerContext.build() client = _env_client(ctx) run_params = RunAppParamsParameters() + parent_run_id = ctx.run_id if not environment: environment = ctx.environment @@ -84,6 +85,7 @@ def run_app( input_body = RunAppParams( environment=environment, parameters=run_params, + parent_run_id=parent_run_id, ) try: diff --git a/src/tower/_context.py b/src/tower/_context.py index f7c134c6..1ee465ac 100644 --- a/src/tower/_context.py +++ b/src/tower/_context.py @@ -7,6 +7,7 @@ def __init__( tower_url: str, environment: str, api_key: str = None, + run_id: str = None, inference_router: str = None, inference_router_api_key: str = None, inference_provider: str = None, @@ -15,6 +16,7 @@ def __init__( self.tower_url = tower_url self.environment = environment self.api_key = api_key + self.run_id = run_id self.jwt = jwt self.inference_router = inference_router self.inference_router_api_key = inference_router_api_key @@ -34,6 +36,7 @@ def build(cls): tower_environment = os.getenv("TOWER_ENVIRONMENT", "default") tower_api_key = os.getenv("TOWER_API_KEY") tower_jwt = os.getenv("TOWER_JWT") + tower_run_id = os.getenv("TOWER__RUNTIME__RUN_ID") # Replaces the deprecated hugging_face_provider and hugging_face_api_key inference_router = os.getenv("TOWER_INFERENCE_ROUTER") @@ -44,6 +47,7 @@ def build(cls): tower_url=tower_url, environment=tower_environment, api_key=tower_api_key, + run_id=tower_run_id, inference_router=inference_router, inference_router_api_key=inference_router_api_key, inference_provider=inference_provider,