MCPcopy Index your code
hub / github.com/google/adk-python / _run

Function _run

contributing/samples/integrations/gepa/experiment.py:178–208  ·  view source on GitHub ↗
(idx: int)

Source from the content-addressed store, hash-verified

176 )
177
178 def _run(idx: int) -> EnvRunResult:
179 try:
180 result = _run_with_retry(idx)
181 except Exception as e:
182 logging.warning('Inference error: %s', str(e))
183 result = EnvRunResult(
184 task_id=idx,
185 reward=0.0,
186 info={
187 'error': str(e),
188 'traceback': traceback.format_exc(),
189 'metrics': dict(reward=0.0),
190 },
191 traj=[],
192 trial=i,
193 )
194
195 if print_results:
196 print(
197 '✅' if result.reward == 1 else '❌',
198 f'task_id={idx}',
199 )
200 print('-----')
201 with lock:
202 data = []
203 if os.path.exists(ckpt_path):
204 with open(ckpt_path, 'r') as f:
205 data = json.load(f)
206 with open(ckpt_path, 'w') as f:
207 json.dump(data + [result.model_dump()], f, indent=2)
208 return result
209
210 with ThreadPoolExecutor(max_workers=config.max_concurrency) as executor:
211 res = list(executor.map(_run, idxs))

Callers

nothing calls this directly

Calls 5

_run_with_retryFunction · 0.85
openFunction · 0.85
existsMethod · 0.45
loadMethod · 0.45
model_dumpMethod · 0.45

Tested by

no test coverage detected