Skip to content

Commit c0f8a7b

Browse files
dorellangcopybara-github
authored andcommitted
Agent Services: Bake client util modules into tarball/docker container.
PiperOrigin-RevId: 931347604
1 parent 519248a commit c0f8a7b

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

perfkitbenchmarker/providers/gcp/gcp_ai_agent_service.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import os
66
import re
7+
import shutil
78
import tarfile
89
from typing import Any, cast, override
910

@@ -72,6 +73,20 @@ def _CreateWorkloadTarball(
7273
full_local_workload_data_path,
7374
arcname=workload_name,
7475
)
76+
common_utils_path = data.ResourcePath('agentic_framework/common_utils.py')
77+
tar.add(
78+
common_utils_path,
79+
arcname=f'{workload_name}/common_utils.py',
80+
)
81+
82+
framework_utils_name = f'{self.spec.framework}_utils.py'
83+
utils_path = data.ResourcePath(
84+
f'agentic_framework/{framework_utils_name}'
85+
)
86+
tar.add(
87+
utils_path,
88+
arcname=f'{workload_name}/{framework_utils_name}',
89+
)
7590
return tar_filename, tar_local_path
7691

7792

@@ -222,9 +237,21 @@ def _StageAgentCode(self):
222237
workload_data_path = (
223238
f'agentic_framework/{self.spec.workload}/{self.spec.framework}'
224239
)
240+
241+
temp_dir = vm_util.PrependTempDir(f'custom_job_{self.spec.workload}')
242+
243+
full_workload_path = data.ResourcePath(workload_data_path)
244+
shutil.copytree(full_workload_path, temp_dir, dirs_exist_ok=True)
245+
common_utils_path = data.ResourcePath('agentic_framework/common_utils.py')
246+
shutil.copy2(common_utils_path, os.path.join(temp_dir, 'common_utils.py'))
247+
248+
framework_utils_name = f'{self.spec.framework}_utils.py'
249+
utils_path = data.ResourcePath(f'agentic_framework/{framework_utils_name}')
250+
shutil.copy2(utils_path, os.path.join(temp_dir, framework_utils_name))
251+
225252
benchmark_spec = context.GetThreadBenchmarkSpec()
226253
self._image_uri = benchmark_spec.container_registry.GetOrBuild(
227-
os.path.basename(workload_data_path), workload_data_path
254+
os.path.basename(workload_data_path), temp_dir
228255
)
229256

230257
@override

0 commit comments

Comments
 (0)