Project

General

Profile

Actions

Bug #21044

open

Collection.clone doesn't handle custom API clients

Added by Brett Smith 7 months ago.

Status:
New
Priority:
Normal
Assigned To:
-
Category:
SDKs
Target version:
Story points:
-

Description

Now that arvados.api returns a arvados.safeapi.ThreadSafeApiCache, we have started telling users to pass api_client to arvados.collection.Collection to prevent memory problems.

When Collection.clone builds a new Collection object, it only does so using apiconfig, defaulting to the user's configuration in environment/disk. This makes it easy to create clones that aren't really, because they point to a completely different cluster. For example:

arv_client = arvados.api('v1', host='not-in-config.example.com', ...)
coll = arvados.collection.Collection(coll_uuid, arv_client)
clone = coll.clone()

clone will now try to talk to the cluster in the user's configuration, not the same one as arv_client.

I think when clone is called with new_config=None:

  • If isinstance(api_client, ThreadSafeApiCache), pass that directly to the new Collection constructor.
  • Otherwise, build a new configuration mapping by introspecting this instance's api_client, and pass that to the new Collection constructor as apiconfig.

No data to display

Actions

Also available in: Atom PDF