pbiecek / archivist

A set of tools for datasets and plots archiving
http://pbiecek.github.io/archivist/
74 stars 9 forks source link

Different archiveTags option for artifact tags and user tags #309

Closed julian-urbano closed 7 years ago

julian-urbano commented 7 years ago

In saveToLocalRepo, there is option archiveTags (boolean) to decide whether to store the tags along with the artifact. Currently, this controls whether to save artifact tags and user tags at the same time, but it'd be nice if we could control them separately.

For instance:

> d <- data.frame(a = 1:2, b = 3:4, c = 5:6)
> saveToLocalRepo(d, archiveTags = TRUE, userTags = c("tag1:val1", "tag2:val2"))
[1] "fbade4980847650272e6d755f6a2e5f4"
> showLocalRepo(method = "tags")
                           artifact                                           tag         createdDate
1  fbade4980847650272e6d755f6a2e5f4                                    format:rda 2017-01-07 19:49:26
2  fbade4980847650272e6d755f6a2e5f4                                        name:d 2017-01-07 19:49:26
3  fbade4980847650272e6d755f6a2e5f4                              class:data.frame 2017-01-07 19:49:26
4  fbade4980847650272e6d755f6a2e5f4                                     varname:a 2017-01-07 19:49:26
5  fbade4980847650272e6d755f6a2e5f4                                     varname:b 2017-01-07 19:49:26
6  fbade4980847650272e6d755f6a2e5f4                                     varname:c 2017-01-07 19:49:26
7  fbade4980847650272e6d755f6a2e5f4                      date:2017-01-07 19:49:26 2017-01-07 19:49:26
8  fbade4980847650272e6d755f6a2e5f4                                     tag1:val1 2017-01-07 19:49:26
9  fbade4980847650272e6d755f6a2e5f4                                     tag2:val2 2017-01-07 19:49:26
10 088e5cc79672b5c70b258e4a23618f42                                    format:rda 2017-01-07 19:49:26
11 fbade4980847650272e6d755f6a2e5f4 session_info:088e5cc79672b5c70b258e4a23618f42 2017-01-07 19:49:26
12 fbade4980847650272e6d755f6a2e5f4                                    format:txt 2017-01-07 19:49:26

It saves the artifact tags (column names), as well as the user tags. If we set archiveTags=FALSE we get:

> d <- data.frame(a = 1:2, b = 3:4, c = 5:6)
> saveToLocalRepo(d, archiveTags = FALSE, userTags = c("tag1:val1", "tag2:val2"))
[1] "fbade4980847650272e6d755f6a2e5f4"
> showLocalRepo(method = "tags")
                          artifact                                           tag         createdDate
1 fbade4980847650272e6d755f6a2e5f4                                    format:rda 2017-01-07 19:51:09
2 088e5cc79672b5c70b258e4a23618f42                                    format:rda 2017-01-07 19:51:10
3 fbade4980847650272e6d755f6a2e5f4 session_info:088e5cc79672b5c70b258e4a23618f42 2017-01-07 19:51:10
4 fbade4980847650272e6d755f6a2e5f4                                    format:txt 2017-01-07 19:51:10

It saves no tag.

So I think it'd be good if we could control whether to save (or not) artifact tags and user tags separately.

MarcinKosinski commented 7 years ago

@julian-urbano thanks for the idea. I think this might be doable : ) I'll consider this and let you know.

MarcinKosinski commented 7 years ago

It requires small changes in https://github.com/pbiecek/archivist/blob/master/R/saveToRepo.R#L198

MarcinKosinski commented 7 years ago

@julian-urbano this should now be possible (with ver 2.1.3 available from GitHub)

julian-urbano commented 7 years ago

Great!