Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

feat: check and warn about dirty git index during deploy #147

Merged
merged 5 commits into from
Aug 4, 2022

Conversation

zevisert
Copy link
Contributor

@zevisert zevisert commented Jul 9, 2022

See #56.

Not sure if the wording is alright with my new errors and logs -- please advise!

@zevisert
Copy link
Contributor Author

zevisert commented Jul 9, 2022

This PR tries to minimize it's footprint. There's a bunch of other places (~5) that call get_app_version. Instead of shiming this new dirty check in there, I could also make a new function to verify the index is clean, and only call that from model.remote_deploy, thoughts?

Switched to explicitly opting out of get_app_version index checking at the callsites.

unionml/remote.py Outdated Show resolved Hide resolved
unionml/model.py Show resolved Hide resolved
@@ -40,10 +41,23 @@ def create_project(remote: FlyteRemote, project: typing.Optional[str]):
remote.client.register_project(Project(id=project, name=project, description=project))


def get_app_version() -> str:
def get_app_version(ignore_diff: bool = True) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

After some reflection, I set the default value to True so that the API behaviour is the same (eg. all get_app_version call-sites need to opt-in to this check). Not sure what your preference is. The unionml cli is the only place that inverts this now, --ignore-diff is used to opt out of the check.

Copy link
Contributor

Choose a reason for hiding this comment

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

my inclination is the stricter the better... ignore_diff = False by default will blow up a deployment attempt unless the use specifically wants to allow uncommitted changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can do that, but #56 is only about failing the deployment. get_app_version is used in a bunch of other places, and in some of them it doesn't make sense to fail over a dirty index (eg: commands like list-model-versions). It's almost always the app_version = app_version or get_app_version() constructs that I think should opt out of this check.

Besides, in the current state of this PR, get_app_version gives an action hint on failure talking about --allow-uncommitted, which isn't a flag that is present everywhere that get_app_version is called. I'll update to allow_uncommitted = False, but to keep the rest of the functionality the same, I'll opt those other callsites out for now

unionml/cli.py Outdated Show resolved Hide resolved
Copy link
Contributor

@cosmicBboy cosmicBboy left a comment

Choose a reason for hiding this comment

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

awesome! changes look good, looks like pre-commit is having issues with convert-myst-to-ipynb... what version of jupytext do you have? Need to pin this in another PR to avoid this issue...

unionml/remote.py Outdated Show resolved Hide resolved
@zevisert
Copy link
Contributor Author

zevisert commented Aug 1, 2022

what version of jupytext do you have?

> pyenv shell 3.7.13/envs/unionml
> jupytext --version 
1.14.0

@cosmicBboy
Copy link
Contributor

cosmicBboy commented Aug 1, 2022

re: pre-commit error, you'll need to rebase onto current main

@cosmicBboy
Copy link
Contributor

hmm, something funny's going on with pre-commit, still investigating...

@cosmicBboy
Copy link
Contributor

k, rebasing onto main should fix the issue

Copy link
Contributor

@cosmicBboy cosmicBboy left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @zevisert !

@cosmicBboy cosmicBboy merged commit bbdfc5c into unionai-oss:main Aug 4, 2022
@zevisert zevisert deleted the zev/check-repo-state branch October 17, 2022 19:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants