fermitools / metacat

Metadata Catalog
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

declare with force #4

Closed rlcee closed 6 months ago

rlcee commented 8 months ago

When running "metacat declare" in a recovery or repair situation, the user might find that the file record 1) does not exist, 2) exists, but is retired or 3) exists unretired. Please consider two switches

Providing this on the server side simply removes the logic and several server calls that it takes to implement these patterns in user code.

marcmengel commented 6 months ago

@rlcee Would perhaps:--overwrite=retired vs --overwrite=any be more descriptive?

I am tempted to change this entirely as an error handlier on the API client side, in a 4.0.1 client release(?)...

rlcee commented 6 months ago

Just thinking about it a little, what feels natural to me is "--if-needed=unretire --if-needed=overwrite". But I don't feel strongly, so please proceed. Please include this option in the python API. As for coding it as a error handler in the client, does that imply making several calls to the server? Would it be more efficient to handle it on the server side? I'm not sure how much a connection costs in time. But I wouldn't really expect this option to be activated frequently, since it is imagined for helping in cleanup of a non-optimal situation. Thanks

marcmengel commented 6 months ago

Yes, the client would be making several calls to the server, if the file exists, but it keeps the server simpler, and thus a smaller change overall.

marcmengel commented 6 months ago

Okay, I googled for similar phrases, and I've come up with --unretire-as-required and --overwrite-as-required. I think that flows better.

marcmengel commented 6 months ago

Okay, so I ended up with --as-required=overwrite or --as=required=unretire.

rlcee commented 6 months ago

Thanks very much!