# Recent Butler changes: Repository class and 'cfg' configuration

**URL:** <https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577>\
**Category:** Data Management\
**Tags:** butler\
**Created:** [March 7, 2016, 4:50pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577 "2016-03-07T16:50:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![natepease](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/natepease/32/2086_2.png) [@natepease](https://www.rubin.community/u/natepease)\
**Post date:** [March 7, 2016, 4:50pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/1 "2016-03-07T16:50:03Z")

</div>

On Friday I checked in changes to butler that add a `Repository` class, and allow butler to be instantiated using a nested dictionary that describes the butler configuration including what mapper to use, mapper policy, what storage type to use, etc.

Documentation that describes these things is in LDM-463. It’s not in master yet, but you can read the version in the ticket branch at [http://ldm-463.lsst.io/en/tickets-dm-5091/](http://ldm-463.lsst.io/en/tickets-dm-5091/)

Of note are sections [2.3 Repository](http://ldm-463.lsst.io/en/tickets-dm-5091/#repository) and [2.7 Butler Configuration](http://ldm-463.lsst.io/en/tickets-dm-5091/#butler-configuration)

Please let me know if you have any questions/comments/etc.

---

<div class="post-metadata">

**Author:** ![natepease](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/natepease/32/2086_2.png) [@natepease](https://www.rubin.community/u/natepease)\
**Post date:** [March 9, 2016, 2:02am UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/2 "2016-03-09T02:02:24Z")

</div>

If you’re running into failures that might be related to this change there are 2 API changes to look for:

The signature to `Butler.queryMetadata` has changed slightly, from  
`def queryMetadata(self, datasetType, key, format=None, dataId={}, **rest)`  
to  
`def queryMetadata(self, datasetType, format=None, dataId={}, **rest)`  
(note that `key` has been removed)  
This is particularly nasty: because of `**rest` the execution won’t see the wrong number of arguments being passed to `queryMetadata`. (One good way to avoid this is to use they keywords when passing arguments).

The signature of the `init` function of `ButlerLocation` has changed, from  
`def __init__ (self, pythonType, cppType, storageName, locationList, dataId)`  
to  
`def __init__ (self, pythonType, cppType, storageName, locationList, dataId, mapper, access=None)`  
(note that `mapper` and `access=None` were added)  
So when creating a `ButlerLocation`, code must now pass in a Mapper that found the info being passed into the ButlerLocation. `Access` is optional (for now at least), and if you don’t have one to pass in then let it be None.

---

<div class="post-metadata">

**Author:** ![timj](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/timj/32/10_2.png) [@timj](https://www.rubin.community/u/timj)\
**Post date:** [March 9, 2016, 8:37pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/3 "2016-03-09T20:37:27Z")

</div>

> [@npease](#):
>
> On Friday I checked in changes to butler

Do I assume by “checked in” you mean “merged to master” and is this the work that was part of [DM-4683](https://jira.lsstcorp.org/browse/DM-4683)?

---

<div class="post-metadata">

**Author:** ![natepease](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/natepease/32/2086_2.png) [@natepease](https://www.rubin.community/u/natepease)\
**Post date:** [March 9, 2016, 8:51pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/4 "2016-03-09T20:51:57Z")

</div>

yes

(this post must be at least 20 characters)

---

<div class="post-metadata">

**Author:** ![timj](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/timj/32/10_2.png) [@timj](https://www.rubin.community/u/timj)\
**Post date:** [March 9, 2016, 8:53pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/5 "2016-03-09T20:53:26Z")

</div>

> [@npease](#):
>
> yes

Ok thanks. Just a note that the LDM-463 document linked from here ends up with some text saying that things will change with DM-4683. Did those things change or is that text needing a new ticket?

---

<div class="post-metadata">

**Author:** ![natepease](https://sea2.discourse-cdn.com/flex002/user_avatar/www.rubin.community/natepease/32/2086_2.png) [@natepease](https://www.rubin.community/u/natepease)\
**Post date:** [March 9, 2016, 8:57pm UTC](https://www.rubin.community/t/recent-butler-changes-repository-class-and-cfg-configuration/577/6 "2016-03-09T20:57:53Z")

</div>

> [@timj](#):
>
> Just a note that the LDM-463 document linked from here ends up with some text saying that things will change with DM-4683. Did those things change or is that text needing a new ticket?

The changes were made to ButlerSubset to accommodate multiple repositories. I’ll pull that note out of the document.
