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

feat: Added the PipelineJob.from_pipeline_func method #1415

Conversation

Ark-kun
Copy link
Contributor

@Ark-kun Ark-kun commented Jun 8, 2022

The new factory method reduces the pipeline submission boilerplate to absolute minimum.

aiplatform.PipelineJob.from_pipeline_func(training_pipeline).submit()

What it does:

  1. Compiles pipeline
  2. Provides sensible default values for the pipeline display name, job_id, context etc.
  3. Generates GCS directory for the pipeline output artifacts if needed
  4. Creates the GCS bucket for the artifacts if it does not exist. (And gives the Pipelines service account the required permissions)

Example usage:

def training_pipeline(number_of_epochs: int = 10):
    train_op(
        number_of_epochs=number_of_epochs,
        learning_rate="0.1",
    )

job = aiplatform.PipelineJob.from_pipeline_func(training_pipeline)
job.submit()

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Jun 8, 2022
@Ark-kun Ark-kun force-pushed the feat--Added-the-PipelineJob.submit_from_pipeline_func-method branch from 62b4c4c to 50ff4fd Compare June 8, 2022 19:38
@sasha-gitg sasha-gitg added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 9, 2022
@Ark-kun Ark-kun marked this pull request as ready for review June 15, 2022 16:01
google/cloud/aiplatform/pipeline_jobs.py Outdated Show resolved Hide resolved
google/cloud/aiplatform/pipeline_jobs.py Outdated Show resolved Hide resolved
google/cloud/aiplatform/utils/gcs_utils.py Show resolved Hide resolved
google/cloud/aiplatform/utils/gcs_utils.py Show resolved Hide resolved
google/cloud/aiplatform/utils/gcs_utils.py Outdated Show resolved Hide resolved
@Ark-kun Ark-kun force-pushed the feat--Added-the-PipelineJob.submit_from_pipeline_func-method branch from 1dff02e to 901d857 Compare June 24, 2022 04:41
@Ark-kun Ark-kun force-pushed the feat--Added-the-PipelineJob.submit_from_pipeline_func-method branch from 0b0842b to 5498f42 Compare June 28, 2022 09:31
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Jun 28, 2022
@Ark-kun Ark-kun changed the title feat: Added the PipelineJob.submit_from_pipeline_func method feat: Added the PipelineJob.from_pipeline_func method Jun 28, 2022
@sasha-gitg sasha-gitg added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels Jun 29, 2022
@Ark-kun Ark-kun force-pushed the feat--Added-the-PipelineJob.submit_from_pipeline_func-method branch from 9aecbaf to 85909e8 Compare July 2, 2022 08:38
@Ark-kun
Copy link
Contributor Author

Ark-kun commented Jul 3, 2022

Hello.

I think I've implemented and resolved all feedback. I've also added the new method to the integration tests and unit tests. (I'm not sure the integration tests are checked during the presubmit).

@Ark-kun Ark-kun requested a review from sasha-gitg July 3, 2022 08:11
google/cloud/aiplatform/pipeline_jobs.py Show resolved Hide resolved
google/cloud/aiplatform/pipeline_jobs.py Outdated Show resolved Hide resolved
google/cloud/aiplatform/utils/gcs_utils.py Outdated Show resolved Hide resolved
tests/system/aiplatform/test_pipeline_job.py Outdated Show resolved Hide resolved
tests/system/aiplatform/test_experiments.py Outdated Show resolved Hide resolved
@sasha-gitg sasha-gitg added the automerge Merge the pull request once unit tests and other checks pass. label Jul 15, 2022
@gcf-merge-on-green gcf-merge-on-green bot merged commit 6ef05de into googleapis:main Jul 15, 2022
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jul 15, 2022
abcdefgs0324 pushed a commit to abcdefgs0324/python-aiplatform that referenced this pull request Jul 20, 2022
The new factory method reduces the pipeline submission boilerplate to absolute minimum.
```python
aiplatform.PipelineJob.from_pipeline_func(training_pipeline).submit()
```

What it does:

1. Compiles pipeline
2. Provides sensible default values for the pipeline display name, job_id, context etc.
3. Generates GCS directory for the pipeline output artifacts if needed
4. Creates the GCS bucket for the artifacts if it does not exist. (And gives the Pipelines service account the required permissions)

Example usage:

```python
def training_pipeline(number_of_epochs: int = 10):
    train_op(
        number_of_epochs=number_of_epochs,
        learning_rate="0.1",
    )

job = aiplatform.PipelineJob.from_pipeline_func(training_pipeline)
job.submit()
```
---
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-aiplatform/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [x] Ensure the tests and linter pass
- [x] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants