Skip to content

Conversation

@davidlatwe
Copy link
Collaborator

This PR aim to resolve #246, the implementation I am proposing is to involve new schema for subset and version, so that we could have a standard to maintain backwards compatibility.

What's changed?

  • New schema files, subset-3.0 and version-3.0
  • In Loader App and Scene Inventory, get data.families from subset document if the schema is subset-3.0

Move required property 'data.families' from version to subset
@davidlatwe
Copy link
Collaborator Author

davidlatwe commented Sep 10, 2019

What I have tested:

  • Publish with new subset schema (Modified config's database integrator plugin)
  • Load in both new and old schema subsets to one scene
  • Check Scene Inventory App display them correctly

Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and clean change @davidlatwe - good work. I'll still have to test it on my end but I did notice something in the code that I think could be improved so I commented on it.

Copy link
Member

@mkolar mkolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking good. Certainly a needed improvement.

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 12, 2019

I've been giving this a roll and backwards compatibility seems smooth, great work! 🚀 I didn't notice it had changed from an Artist's perspective.

However, I did have a question. How did you end up updating your integrator?

Be aware when updating your integrator:
I moved the storing of the families data to the subset as opposed to the version. However, of course an existing subset would still have the previous schema and wasn't "created" for this publish. As such, suddenly I have a subset without families (old one) and the new version also without families. The result was that the subset wouldn't show in the Loader.

Should have thought of that of course. :) Just wondering how you adapted for this situation @davidlatwe.

@davidlatwe
Copy link
Collaborator Author

davidlatwe commented Sep 12, 2019

Ah, have you updated the version and subset schema name in your integrator plugin ?
Here's my change for this PR in my config, 👉 🚪 (plugins/global/publish/integrate_avalon_subset.py)
Edit: ☝️ this isn't correct, see the comment below

@davidlatwe
Copy link
Collaborator Author

Oh, wait, I might misunderstand your case, let me take a look

@BigRoy
Copy link
Collaborator

BigRoy commented Sep 12, 2019

Ah, I see. You have it as an if/else deciding between putting families in the data of subset/version here based on subset schema version. Simple enough.

I ended up actually updating my subset version:

# example psuedocode
if subset and subset["schema"] == "avalon-core:subset-2.0":
    self.log.info("Updating subset {name} "
                  "'{schema}' to schema "
                  "'avalon-core:subset-3.0'".format(**subset))
    subset_original = copy.deepcopy(subset)
    subset["schema"] = "avalon-core:subset-3.0"
    subset["data"]["families"] = _get_families(instance)
    schema.validate(subset)
    result = io.replace_one(subset_original, subset)
    assert result.modified_count == 1, "Subset schema update failed."

I guess your way should have been the way to go though, to leave whatever was as close to the originals as possible.

Anyway, it seems I am unable to find the new version 3 subset document in the Loader. Nevermind, false alarm. Somehow my Python session was using an older loader, restarted the host and all was fine.

👍 Smooth sailing from here on out.

Copy link
Collaborator

@BigRoy BigRoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work David! 🚀 Feel free to merge.

@davidlatwe
Copy link
Collaborator Author

davidlatwe commented Sep 12, 2019

Okay, I get the picture now :P

Should have thought of that of course. :)

I actually didn't ! Big thanks for the heads up !
Yeah, the old subset required to be updated so it could work with new version that use new schema.

But I think the best and simple option for anyone prepare to adopt this PR is :

  • If subset already exists, do not use new schema on next version.
  • If subset will be created on integration, do use the new schema on both subset and version.

So that you won't need to worry breaking anything already existed. :)

@davidlatwe
Copy link
Collaborator Author

To be complete, here's what I have for my config to adopt this PR. 👉 🚪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Store and lock the "family" on a "subset"

4 participants