Actions
Bug #21044
openCollection.clone doesn't handle custom API clients
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 newCollection
constructor. - Otherwise, build a new configuration mapping by introspecting this instance's
api_client
, and pass that to the newCollection
constructor asapiconfig
.
No data to display
Actions