aind-codeocean-dispatch 0.2.1__py3-none-any.whl → 0.2.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,9 @@ counters rather than locks, and no thread is parked per job.
6
6
 
7
7
  Error policy
8
8
  ------------
9
- The SDK's client retries nothing by default, so every 429 or 5xx surfaces here.
9
+ Every 429 or 5xx must surface here, so :func:`run_jobs` works on a copy of the
10
+ client with ``retries=0``: transport-level retries would resend POSTs below this
11
+ policy, and their exhausted retries raise without the status code it reads.
10
12
 
11
13
  - **429** is retried on every call, honouring ``Retry-After``: the server rejected
12
14
  the request without acting on it.
@@ -232,7 +234,8 @@ def run_jobs(
232
234
  Parameters
233
235
  ----------
234
236
  client : CodeOcean
235
- Authenticated client.
237
+ Authenticated client. Its own ``retries`` setting is overridden on a copy;
238
+ the caller's client is left unchanged.
236
239
  jobs : Sequence[Job]
237
240
  Launched in order, subject to the cap and pacing.
238
241
  max_in_flight : int, optional
@@ -271,7 +274,7 @@ def run_jobs(
271
274
  """
272
275
  _validate(jobs, max_in_flight=max_in_flight, start_retries=start_retries, capture_retries=capture_retries)
273
276
  return _Dispatcher(
274
- client,
277
+ _without_transport_retries(client),
275
278
  jobs,
276
279
  max_in_flight=max_in_flight,
277
280
  launch_interval_s=launch_interval_s,
@@ -284,6 +287,18 @@ def run_jobs(
284
287
  ).run()
285
288
 
286
289
 
290
+ def _without_transport_retries(client: CodeOcean) -> CodeOcean:
291
+ """Return *client*, or a copy with ``retries=0`` if it retries requests itself.
292
+
293
+ The copy opens a new session, so anything mounted on the original's ``session``
294
+ by hand is not carried over.
295
+ """
296
+ if client.retries in (0, None):
297
+ return client
298
+ logger.info("using a copy of the client with retries=0 (was %r); run_jobs retries what is safe", client.retries)
299
+ return dataclasses.replace(client, retries=0)
300
+
301
+
287
302
  def _validate(jobs: Sequence[Job], *, max_in_flight: int | None, start_retries: int, capture_retries: int) -> None:
288
303
  labels = [job.label for job in jobs]
289
304
  if len(set(labels)) != len(labels):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: aind-codeocean-dispatch
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Launch, monitor, and capture batches of Code Ocean capsule runs
5
5
  Project-URL: Repository, https://github.com/AllenNeuralDynamics/aind-codeocean-dispatch/
6
6
  Project-URL: Issues, https://github.com/AllenNeuralDynamics/aind-codeocean-dispatch/issues
@@ -0,0 +1,7 @@
1
+ aind_codeocean_dispatch/__init__.py,sha256=NcdbegNPvYKWVRArhlkdEL7HP9kof1OOiH8aRcrcszY,660
2
+ aind_codeocean_dispatch/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
+ aind_codeocean_dispatch/runner.py,sha256=Zwfvt7NuLxrCrV6t8KPfgiqkdBlV8e6XlcXkkJKwKHk,25344
4
+ aind_codeocean_dispatch-0.2.2.dist-info/METADATA,sha256=LMBckmvXZjxfWyeGaIw-siS4aDAYETmCEnVcWwVWYyg,2797
5
+ aind_codeocean_dispatch-0.2.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
6
+ aind_codeocean_dispatch-0.2.2.dist-info/licenses/LICENSE,sha256=zMZxYbR1i_XxgyJP_rPSWKcxY7QtyxUOzbIpowHNjCs,1093
7
+ aind_codeocean_dispatch-0.2.2.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- aind_codeocean_dispatch/__init__.py,sha256=NcdbegNPvYKWVRArhlkdEL7HP9kof1OOiH8aRcrcszY,660
2
- aind_codeocean_dispatch/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
3
- aind_codeocean_dispatch/runner.py,sha256=6z6mt520K08TVGXdLJuYG3Q_Dqgef2UbEOHkE2qGJJk,24559
4
- aind_codeocean_dispatch-0.2.1.dist-info/METADATA,sha256=NKCY6sbelEID-ZiXGEYdiAUY89d0PhiarMm0o4Qzt20,2797
5
- aind_codeocean_dispatch-0.2.1.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
6
- aind_codeocean_dispatch-0.2.1.dist-info/licenses/LICENSE,sha256=zMZxYbR1i_XxgyJP_rPSWKcxY7QtyxUOzbIpowHNjCs,1093
7
- aind_codeocean_dispatch-0.2.1.dist-info/RECORD,,