Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RPD-284] Update AzureRunner to select the Terraform files corresponding to the stack name in the config file #187

Conversation

Christopher-Norman
Copy link
Member

@Christopher-Norman Christopher-Norman commented Aug 8, 2023

This PR:

  1. Renames the resources Terraforms file to default.
  2. Adds functionality within core.py provision function to collect the stack name and use that as a pointer to the specified set of Terraform files.
  3. If this value does not exist it will create it and use the default stack.

This PR also fixes a bug where an error would be thrown due to the matcha.config.json file not being empty but not containing information relating to a resource group.

This has been tested with both stacks.

One possible improvement is that when using the default stack an empty chroma folder is still created within .matcha/infrastructure/resources.

Checklist

Please ensure you have done the following:

  • I have read the CONTRIBUTING guide.
  • I have updated the documentation if required.
  • I have added tests which cover my changes.

Type of change

Tick all those that apply:

  • Bug Fix (non-breaking change, fixing an issue)
  • New feature (non-breaking change to add functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

KirsoppJ and others added 25 commits August 3, 2023 15:34
* various changes

* change variable names to make things more clear

* shubham's comment

* test for latest

* update existing tests

* update existing tests

* shubham latest comment

* add gitflow notation branches to ci (#183)

* remove old, commented out code
* adds logic and tests for matcha config module

* updates docstrings

* adds tests and implements config object throughout matcha

* updated for pr comments

* updates docstring

* fixes ci

* updates for comments
…core-function-for-updating-stack-type

# Conflicts:
#	src/matcha_ml/core/core.py
…dating-stack-type' into RPD-284-update-azurerunner-to-select-terraform-files
@Christopher-Norman Christopher-Norman added the enhancement New feature or request label Aug 8, 2023
@Christopher-Norman Christopher-Norman self-assigned this Aug 8, 2023
@Christopher-Norman Christopher-Norman changed the title [WIP] [RPD-284] Update AzureRunner to select the Terraform files corresponding to the stack name in the config file [RPD-284] Update AzureRunner to select the Terraform files corresponding to the stack name in the config file Aug 9, 2023
Copy link
Contributor

@KirsoppJ KirsoppJ left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@JonoCX JonoCX left a comment

Choose a reason for hiding this comment

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

Nice work! Just one comment about separating functionality

src/matcha_ml/core/core.py Outdated Show resolved Hide resolved
Copy link
Member

@JonoCX JonoCX left a comment

Choose a reason for hiding this comment

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

Nice, a couple of architectural changes and we're good to go

src/matcha_ml/config/matcha_config.py Outdated Show resolved Hide resolved
src/matcha_ml/config/matcha_config.py Outdated Show resolved Hide resolved
Copy link
Member

@JonoCX JonoCX left a comment

Choose a reason for hiding this comment

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

LGTM. It'd be good to address the nit to simplify the code a little

with remote_state_manager.use_lock(), remote_state_manager.use_remote_state():
project_directory = os.getcwd()
destination = os.path.join(
project_directory, ".matcha", "infrastructure", "resources"
)

stack = MatchaConfigService.get_stack()
Copy link
Member

Choose a reason for hiding this comment

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

Nit: this stack shouldn't be None seeing as you set the stack earlier if there is no stack, so you can simplify this into a one liner on 294: MatchaConfigService.get_stack().value (no call to lower() as that's done in stack_set either way)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, this was the original implementation but mypy doesn't like this though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also, I believe lower() is required as the values are stored in matcha.config.json as LLM or DEFAULT

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps adding a type to the stack variable in the original implementation may help: stack: Optional[MatchaConfigComponentProperty] = ...

On the lower(), if the internals are using the stack enum (they should), then the values should all be lower case

No worries if there's no work around for mypy

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed lower casing. No work around for mypy.

Copy link
Member

@JonoCX JonoCX left a comment

Choose a reason for hiding this comment

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

✅ 🌯

@Christopher-Norman Christopher-Norman merged commit 407be1c into feature/llm-stack Aug 14, 2023
2 checks passed
@Christopher-Norman Christopher-Norman deleted the RPD-284-update-azurerunner-to-select-terraform-files branch August 14, 2023 10:47
JonoCX added a commit that referenced this pull request Aug 15, 2023
* [RPD-282] adds stack cli command (#179)

* adds tests and logic for stack and stack set cli commands

* fixes typos

* updated for comments

* addresses comments

* [RPD-285] Create LLM stack Terraform files (#182)

* Add initial LLM Terraform files

* Update Terraform Kubernetes Chroma deployment

* Update Terraform docs

* Revert default variables

* Add missing aks module

* [RPD-283] add core function for updating stack type (#185)

* [RPD-287] ZenML version inference for zenserver (#180)

* various changes

* change variable names to make things more clear

* shubham's comment

* test for latest

* update existing tests

* update existing tests

* shubham latest comment

* add gitflow notation branches to ci (#183)

* remove old, commented out code

* [RPD-260] Add an object to handle the `matcha.config.json` file. (#184)

* adds logic and tests for matcha config module

* updates docstrings

* adds tests and implements config object throughout matcha

* updated for pr comments

* updates docstring

* fixes ci

* updates for comments

* enum and metaclass

* enum and metaclass

* bug removal

* docstring stack_set

* docstring file exists

* fix current tests

* add a couple tests, move logic for updating to configservice

* lowercase-ify arg to enum

* american spelling

* american spelling

* chris' comment re overwriting

* friendlier api

* Runtime error if not recognised arg type fpor update()

* Runtime error if not recognised arg type fpor update()

* update provision to use new update() API

* update stack name

* tests

* tests

* tests

* quote marks

* type version, mypy

* various review comments

* test for update() function

* update tests to include quotes.

* fixing tests

* tidy tests, test error if resources provisioned

* clearer error handling

* remove unnecessary context

* update test to new error type

---------

Co-authored-by: Callum Wells <68609181+swells2020@users.noreply.github.com>

* [RPD-286] Add documentation on "stacks" and the new LLM stack (#189)

* Initial version of docs

* Add motivation to stacks docs

* Various docs updates based on reviews

* [RPD-284] Update AzureRunner to select the Terraform files corresponding to the stack name in the config file (#187)

* [RPD-287] ZenML version inference for zenserver (#180)

* various changes

* change variable names to make things more clear

* shubham's comment

* test for latest

* update existing tests

* update existing tests

* shubham latest comment

* add gitflow notation branches to ci (#183)

* remove old, commented out code

* [RPD-260] Add an object to handle the `matcha.config.json` file. (#184)

* adds logic and tests for matcha config module

* updates docstrings

* adds tests and implements config object throughout matcha

* updated for pr comments

* updates docstring

* fixes ci

* updates for comments

* enum and metaclass

* enum and metaclass

* bug removal

* docstring stack_set

* docstring file exists

* fix current tests

* add a couple tests, move logic for updating to configservice

* lowercase-ify arg to enum

* american spelling

* american spelling

* chris' comment re overwriting

* friendlier api

* Runtime error if not recognised arg type fpor update()

* Runtime error if not recognised arg type fpor update()

* update provision to use new update() API

* update stack name

* tests

* tests

* tests

* Move files for selection

* Clean up file

* Remove a test that no longer describes the expected functionality

* Remove a test that no longer describes the expected functionality

* Fix tests

* Stop creation of config file in local directory when running tests

* Update check to use MatchaConfig object instead of to dict

* Add get current stack name function to MatchaConfigService

* Update get stack function

* Fix test

* Remove unnecessary lower casing

* Fix tests

* updates stack handling

* Revert "updates stack handling"

This reverts commit b42b31d.

* [RPD-289] Update the Chroma Terraform within the LLM stack to use Helm #194

* [RPD-292] [BUG] Update AzureTemplate to not create redundant folders during provisioning (#195)

* splits default stack

* updates llm stack

* [RPD-303] Update stack_set docstring to include example and raises (#196)

---------

Co-authored-by: Callum Wells <68609181+swells2020@users.noreply.github.com>
Co-authored-by: KirsoppJ <40233184+KirsoppJ@users.noreply.github.com>
Co-authored-by: Jonathan Carlton <JonoCX@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants