databroker icon indicating copy to clipboard operation
databroker copied to clipboard

Make it easier to copy files to an external databroker.

Open CJ-Wright opened this issue 8 years ago • 8 comments

As @tacaswell and I have been discussing it may be helpful to have db.export act somewhat as a callback. Most of this is handled in db.insert, but the copying of assets and assetstore records is not. Potentially related to #246

CJ-Wright avatar Aug 15 '17 13:08 CJ-Wright

Could you clarify with an example what you mean by "act somewhat" as a callback?

danielballan avatar Aug 15 '17 13:08 danielballan

I can pass individual documents to it.

RE.subscribe(main_db.insert)
RE.subscribe(export_to_db2_for_user_to_take_home)
for nd_pair in hdr.documents():
    db.export(nd_pair)

CJ-Wright avatar Aug 15 '17 13:08 CJ-Wright

Why not use db.insert?

danielballan avatar Aug 15 '17 14:08 danielballan

Missing filestore records, files not copied into exportable folder.

CJ-Wright avatar Aug 15 '17 14:08 CJ-Wright

@CJ-Wright Belatedly, you had a fair point. The asset refactor make this much easier to do. See example: https://gist.github.com/danielballan/24a1e6c055fe24d764462169727dd89f

Once we figure out how to parameterize that nicely, something like it will go into suitcase I think.

danielballan avatar May 24 '18 18:05 danielballan

What do you mean "parameterize that nicely"?

CJ-Wright avatar May 24 '18 18:05 CJ-Wright

My example hard-codes assumptions about how to layout the data in the HDF5 file. We have make some assumptions at the level of the Python code, but we'll probably let users configure it a little more than we do in that example.

danielballan avatar May 25 '18 13:05 danielballan

Coming back to the original question:

It may be helpful to have db.export act somewhat as a callback. Most of this is handled in db.insert, but the copying of assets and assetstore records is not.

Now that all "assetstore records" (datum and resource documents) do go through db.insert, the only remaining issue is copying files to a second location. Some of the db.export code should be factored out to make that easier.

danielballan avatar May 25 '18 16:05 danielballan