@@ -929,19 +929,24 @@ async def _register_service_replica(
929929 session , context .run_model .gateway_id
930930 )
931931 gateway_target = events .Target .from_model (gateway_model )
932+ assert context .job_model .instance is not None
933+ instance_project_ssh_private_key = None
934+ if context .job_model .project_id != context .job_model .instance .project_id :
935+ instance_project_ssh_private_key = context .job_model .instance .project .ssh_private_key
936+ # JobRuntimeData might change on PULLING -> RUNNING path
937+ # so we must update job_submission with the result value.
938+ job_submission = context .job_submission .copy (deep = True )
939+ job_submission .job_runtime_data = _get_result_job_runtime_data (context .job_model , result )
932940 try :
933941 logger .debug (
934942 "%s: registering replica for service %s" , fmt (context .job_model ), context .run .id .hex
935943 )
936- # JobRuntimeData might change on PULLING -> RUNNING path
937- # so we must update job_submission with the result value.
938- job_submission = context .job_submission .copy (deep = True )
939- job_submission .job_runtime_data = _get_result_job_runtime_data (context .job_model , result )
940944 async with conn .client () as gateway_client :
941945 await gateway_client .register_replica (
942946 run = context .run ,
943947 job_spec = JobSpec .__response__ .parse_raw (context .job_model .job_spec_data ),
944948 job_submission = job_submission ,
949+ instance_project_ssh_private_key = instance_project_ssh_private_key ,
945950 ssh_head_proxy = ssh_head_proxy ,
946951 ssh_head_proxy_private_key = ssh_head_proxy_private_key ,
947952 )
0 commit comments