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

Persist Labels to Vertex AI Custom Job #198

Merged
merged 7 commits into from
Aug 8, 2023

Conversation

jhamet93
Copy link
Contributor

@jhamet93 jhamet93 commented Jul 28, 2023

When the Prefect Agent fetches the Infrastructure from a Deployment to execute a FlowRun for a particular Flow, a set of labels is computed and set in the associated Infrastructure for a particular deployment.

https://github.com/PrefectHQ/prefect/blob/e530ca3285764accaef9360ba17e84610cb7e0cf/src/prefect/infrastructure/base.py#L88-L119

It would be helpful if these labels can be persisted to the underlying Vertex AI Custom Job resource. This would enable effective querying for particular jobs that match a given condition (e.g. all the CustomJobs associated with a particular FlowRun). Otherwise especially in environments where many CustomJobs are run, it's cumbersome to make the association and attribution.

Closes #200

Checklist

  • [✅ ] References any related issue by including "Closes #" or "Closes ".
    • If no issue exists and your change is not a small fix, please create an issue first.
  • [ ✅ ] Includes tests or only affects documentation.
  • [✅ ] Passes pre-commit checks.
    • Run pre-commit install && pre-commit run --all locally for formatting and linting.
  • [ ✅ ] Includes screenshots of documentation updates.
    • Run mkdocs serve view documentation locally.
  • [ ✅ ] Summarizes PR's changes in CHANGELOG.md

@jhamet93 jhamet93 requested a review from a team as a code owner July 28, 2023 01:12
@zzstoatzz
Copy link
Contributor

thanks for the contribution @jhamet93!

it looks like the pre-commits are failing, could you go ahead and run those locally and push things back up?

@jhamet93 jhamet93 force-pushed the Persist_Labels_To_GCP_Resource branch from 48e2099 to 80500cb Compare August 3, 2023 17:55
@jhamet93 jhamet93 force-pushed the Persist_Labels_To_GCP_Resource branch from 80500cb to e610be3 Compare August 3, 2023 17:58
@jhamet93
Copy link
Contributor Author

jhamet93 commented Aug 3, 2023

thanks for the contribution @jhamet93!

it looks like the pre-commits are failing, could you go ahead and run those locally and push things back up?

Done!

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

I have one small request, but otherwise this looks great!

prefect_gcp/aiplatform.py Outdated Show resolved Hide resolved
prefect_gcp/aiplatform.py Outdated Show resolved Hide resolved
@jhamet93
Copy link
Contributor Author

jhamet93 commented Aug 7, 2023

I have one small request, but otherwise this looks great!

Great thanks! Amended the method name.

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

LGTM!

@desertaxle desertaxle merged commit bce8dda into PrefectHQ:main Aug 8, 2023
10 checks passed
jeremy-thomas-roc pushed a commit to jeremy-thomas-roc/prefect-gcp that referenced this pull request Aug 31, 2023
* Persist Labels to Vertex AI Custom Job

* ensure compatible with GCP requirements

* small bug not fetching key-value pairs

* Add test, changelog, and format

* pre commit hook changes

* Feedback for method name

---------

Co-authored-by: Alexander Streed <[email protected]>
desertaxle added a commit that referenced this pull request Sep 19, 2023
* add accelerator count

* update changelog

* added test

* fix jobs not canceling in vertex

* add accelerator count

* update changelog

* added test

* fix jobs not canceling in vertex

* revert bad changes

* update changelog

* update changelog

* added test

* revert bad changes

* update changelog

* update changelog

* Bump JamesIves/github-pages-deploy-action from 4.4.2 to 4.4.3 (#196)

Bumps [JamesIves/github-pages-deploy-action](https://github.com/jamesives/github-pages-deploy-action) from 4.4.2 to 4.4.3.
- [Release notes](https://github.com/jamesives/github-pages-deploy-action/releases)
- [Commits](JamesIves/github-pages-deploy-action@v4.4.2...v4.4.3)

---
updated-dependencies:
- dependency-name: JamesIves/github-pages-deploy-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Streed <[email protected]>

* Persist Labels to Vertex AI Custom Job (#198)

* Persist Labels to Vertex AI Custom Job

* ensure compatible with GCP requirements

* small bug not fetching key-value pairs

* Add test, changelog, and format

* pre commit hook changes

* Feedback for method name

---------

Co-authored-by: Alexander Streed <[email protected]>

* revert

* add optional vertex job name

* update changelog

* revert bad merge

* change job name to reference flow run name

* changelog

* handle none values

* handle none values

* code review changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexander Streed <[email protected]>
Co-authored-by: Josh Hamet <[email protected]>
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.

Persist Labels from Prefect to Vertex AI Job
3 participants