Feature #17635

Support 'preserve_version' flag on Collection.save

Added by Peter Amstutz about 1 year ago. Updated 6 months ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
SDKs
Target version:
Start date:
11/11/2021
Due date:
% Done:

100%

Estimated time:
(Total: 0.00 h)
Story points:
-
Release relationship:
Auto

Description

  • Collection class in the Python SDK should support the "preserve_version" flag on the save() method
  • If preserve_version is true and CollectionVersioning is false in the config, decide which one of these things should happen:
    • Save a snapshot version as if CollectionVersioning is true (since it was asked for explicitly)
    • Return an error (so the user knows the version won't be preserved)

Subtasks

Task #18356: Review 17635-pysdk-collection-preserve-versionResolvedPeter Amstutz


Related issues

Has duplicate Arvados - Story #18312: Collection versioning tweaksClosed

History

#1 Updated by Peter Amstutz 7 months ago

  • Description updated (diff)

#2 Updated by Peter Amstutz 7 months ago

  • Has duplicate Story #18312: Collection versioning tweaks added

#3 Updated by Peter Amstutz 7 months ago

  • Target version set to 2021-11-24 sprint

#4 Updated by Ward Vandewege 7 months ago

  • Release set to 45

#5 Updated by Peter Amstutz 6 months ago

  • Assigned To set to Lucas Di Pentima

#6 Updated by Lucas Di Pentima 6 months ago

  • Status changed from New to In Progress

#7 Updated by Lucas Di Pentima 6 months ago

Updates at d35c1a749 - branch 17635-pysdk-collection-preserve-version
Test run: developer-run-tests: #2790

  • Exports Collections.CollectionVersioning config so that arvados.Collection knows when to return an error.
  • Adds preserve_version (False by default) parameter to save() and save_new() methods on the arvados.Collection class. When collection versioning isn't enabled and the parameter is set to True, it raises an exception.
  • Adds tests.

#8 Updated by Peter Amstutz 6 months ago

Lucas Di Pentima wrote:

Updates at d35c1a749 - branch 17635-pysdk-collection-preserve-version
Test run: developer-run-tests: #2790

  • Exports Collections.CollectionVersioning config so that arvados.Collection knows when to return an error.

I had envisioned that the API server would return an error, instead of just doing a client side check. The main drawback is that it will break clients (like wb2) that always send preserve_version=true. So maybe a client side check is the best we can do. Changing the the API server behavior seems out of scope for this ticket.

  • Adds preserve_version (False by default) parameter to save() and save_new() methods on the arvados.Collection class. When collection versioning isn't enabled and the parameter is set to True, it raises an exception.

I had to think really hard about how it could make sense to have preserve_version parameter on save_new() before remembering the original meaning/behavior of the preserve_version flag (that we make sure the version we just wrote will be preserved on future update). Can we explain it better somehow?

#9 Updated by Lucas Di Pentima 6 months ago

Updates at b1a88ceac

  • Improved documentation

#10 Updated by Peter Amstutz 6 months ago

Lucas Di Pentima wrote:

Updates at b1a88ceac

  • Improved documentation

If True, the newly saved collection will generate a new snapshot of
itself on the next versionable update. This parameter requires that
the Collections.CollectionVersioning is enabled and will raise an
exception otherwise.

Can we rephrase this a little bit, like

"If True, indicate that the collection content being saved right now should be preserved in a version snapshot if the collection record is updated in the future. Requires that the API server has Collections.CollectionVersioning enabled, if not, setting this will raise an exception."

#11 Updated by Lucas Di Pentima 6 months ago

  • Status changed from In Progress to Resolved

Applied in changeset arvados-private:commit:arvados|3849ee94bbe65ef79df8f50c87b5445a5b1d4877.

Also available in: Atom PDF