NNPDF / pineappl

PineAPPL is not an extension of APPLgrid
https://nnpdf.github.io/pineappl/
GNU General Public License v3.0
12 stars 3 forks source link

Keep a log of modification dates and PineAPPL versions #110

Open cschwan opened 2 years ago

cschwan commented 2 years ago

Most modifying operations should add an entry to the metadata serving as a log, containing

1) the operation that was performed 2) the date the operation and 3) the PineAPPL version that was used.

The following operations are interesting for us:

We don't want the following operations:

alecandido commented 2 years ago

So, I guess we give up with the idea to add something during Grid::write, and the log is added directly in memory (even if it's not dumped), isn't it?

cschwan commented 2 years ago

@AleCandido Well, Grid::write can't know if the other methods don't add to the log. But without a final Grid::write the log wouldn't be written to disk, so effectively it does make the change. How would you propose to do it instead?

alecandido commented 2 years ago

Nothing else, perfectly fine like this.

I simply thought that you would a written a log of writes, that of course would miss the information on the operations (and both multiple and no operations would be collapsed on a single one), but it would have been always present. So, even if you introduce a new method without adding the logging part, it could not escape the default logging on Grid::write, but it's globally worse than your proposal.

The only other thing I can imagine at this point is to keep a separate "temporary log" as a Grid attribute (or just different metadatum), containing only the logs of the current session, and then consume this information in Grid::write. In this way you can ensure logging in Grid::write, but on the other hand it would have access to the whole session history. The only drawback of this approach is the extra complication, that is not negligible.

cschwan commented 2 years ago

The only other thing I can imagine at this point is to keep a separate "temporary log" as a Grid attribute (or just different metadatum), containing only the logs of the current session, and then consume this information in Grid::write. In this way you can ensure logging in Grid::write, but on the other hand it would have access to the whole session history. The only drawback of this approach is the extra complication, that is not negligible.

That's more or less what I was thinking about!

felixhekhorn commented 2 years ago

I guess something like this?

[
["Grid::convolute_eko", str(datetime.now()), __version__],
...
]
cschwan commented 2 years ago

Exactly! That's we'd to have, right?

alecandido commented 2 years ago

Maybe I would fix the element at four fields, with the last one a string containing method specific information (e.g. for Grid::convolute_eko might be a hash of the operator, or some other kind of brief summary).

cschwan commented 2 years ago

@AleCandido good idea!

felixhekhorn commented 2 years ago

Maybe I would fix the element at four fields, with the last one a string containing method specific information (e.g. for Grid::convolute_eko might be a hash of the operator, or some other kind of brief summary).

with an emphasis on brief ;-)