Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 660769828
Change-Id: I96db818ed58963ec96888cbbab631d3b7971c86a
  • Loading branch information
cahlheim authored and copybara-github committed Aug 8, 2024
1 parent 6b98e41 commit a63235e
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 29 deletions.
14 changes: 14 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

83 changes: 54 additions & 29 deletions demo_with_real_data_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,8 @@
"outputs": [],
"source": [
"from kfp import dsl\n",
"from kfp.v2 import compiler\n",
"from kfp.v2.dsl import component\n",
"from kfp.v2.google.client import AIPlatformClient\n",
"from kfp import compiler\n",
"from kfp.dsl import component\n",
"\n",
"\n",
"@component(base_image=f\"gcr.io/{pipeline.project_id}/crystalvalue:latest\")\n",
Expand All @@ -561,30 +560,41 @@
"compiler.Compiler().compile(\n",
" pipeline_func=crystalvalue_pipeline,\n",
" package_path=\"crystalvaluepipeline.json\"\n",
")\n",
"\n",
"# Choose a region compatible with Vertex Pipelines. \n",
"# This doesn't have to be the same as your data location.\n",
"api_client = AIPlatformClient(\n",
" project_id=pipeline.project_id,\n",
" region=pipeline.location,\n",
")"
]
},
{
"cell_type": "markdown",
"id": "R9IqRsP3_Ky0",
"metadata": {
"id": "R9IqRsP3_Ky0"
"id": "zNSjgatukOKR"
},
"cell_type": "code",
"source": [
"from google.cloud import aiplatform\n",
"\n",
"(Optional) Check if your pipeline runs using the following function:\n",
"# Choose a region compatible with Vertex Pipelines. \n",
"# This doesn't have to be the same as your data location.\n",
"\n",
"```\n",
"api_client.create_run_from_job_spec(job_spec_path=\"crystalvaluepipeline.json\")\n",
"```"
]
"PROJECT_ID = pipeline.project_id,\n",
"REGION=pipeline.location,\n",
"DISPLAY_NAME='crystalvalue_pipeline',\n",
"PIPELINE_ROOT=f\"gs://{BUCKET_NAME}/pipeline_root\",\n",
"PACKAGE_PATH=\"crystalvaluepipeline.json\",\n",
"aiplatform.init(\n",
" project=PROJECT_ID,\n",
" location=REGION,\n",
")\n",
"\n",
"pipeline_job = aiplatform.PipelineJob(\n",
" display_name=DISPLAY_NAME,\n",
" template_path=PACKAGE_PATH,\n",
" pipeline_root=PIPELINE_ROOT,\n",
")\n",
"\n",
"## Check if your pipeline is running.\n",
"job.submit()"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -597,19 +607,20 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "NvdMHFG56t8o",
"metadata": {
"id": "NvdMHFG56t8o"
"id": "t7L0QRKOaLYM"
},
"outputs": [],
"cell_type": "code",
"source": [
"response = api_client.create_schedule_from_job_spec(\n",
" job_spec_path=\"crystalvaluepipeline.json\",\n",
" schedule=\"0 1 * * *\",\n",
" time_zone=\"America/Los_Angeles\")"
]
"pipeline_job_schedule = pipeline_job.create_schedule(\n",
" display_name=\"crystalvalue_pipeline_schedule\",\n",
" cron=\"TZ=CRON\",\n",
" max_concurrent_run_count=MAX_CONCURRENT_RUN_COUNT,\n",
" max_run_count=MAX_RUN_COUNT,\n",
")"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -619,9 +630,23 @@
},
"source": [
"You can view your running and scheduled pipelines at:\n",
"https://console.cloud.google.com/vertex-ai/pipelines"
"https://console.cloud.google.com/vertex-ai/pipelines or by adjusting the code below."
]
},
{
"metadata": {
"id": "ac4RlBqXaLYM"
},
"cell_type": "code",
"source": [
"aiplatform.PipelineJobSchedule.list(\n",
" filter='display_name=\"DISPLAY_NAME\"',\n",
" order_by='create_time desc'\n",
")"
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"id": "yNZpQxNU-cIi",
Expand Down
25 changes: 25 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""The setup script for Crystalvalue."""

from setuptools import find_packages
from setuptools import setup


setup(
name="crystalvalue",
version="0.1",
packages=find_packages(),
)
14 changes: 14 additions & 0 deletions src/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

0 comments on commit a63235e

Please sign in to comment.