Skip to content

Commit

Permalink
fix(retail): updates tutorial for new location (#8983)
Browse files Browse the repository at this point in the history
Clean up for the monorepo migration effort: this PR is similar to [this nodejs-docs-samples PR](https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/2985).
  • Loading branch information
telpirion authored Jan 19, 2023
1 parent 4939eec commit f34f89b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions retail/interactive-tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can find the information about the Retail services in the [documentation](ht
If you would like to have a closer look at the Retail API features and try them yourself,
the best option is to use the [Interactive Tutorials](https://cloud.google.com/retail/docs/overview). The tutorials will be launched in the CloudShell environment, and you will be able to request the Retail services and check the response with minimum time and effort.

The code samples in the directory **python-retail/samples/interactive-tutorials** are explicitly created for use with the Retail Interactive Tutorials.
The code samples in the directory **python-docs-samples/retail/interactive-tutorials** are explicitly created for use with the Retail Interactive Tutorials.

If, for some reason, you have decided to proceed with these code samples without the tutorial, please go through the following steps and set up the required preconditions.

Expand Down Expand Up @@ -133,9 +133,9 @@ To run Python code samples for the Retail API tutorial, you need to set up your

## Import catalog data

There is a python-retail/samples/interactive-tutorials/resources/products.json file with valid products prepared in the `resources` directory.
There is a python-docs-samples/retail/interactive-tutorials/resources/products.json file with valid products prepared in the `resources` directory.

The other file, python-retail/samples/interactive-tutorials/resources/products_some_invalid.json, contains both valid and invalid products. You will use it to check the error handling.
The other file, python-docs-samples/retail/interactive-tutorials/resources/products_some_invalid.json, contains both valid and invalid products. You will use it to check the error handling.

### Upload catalog data to Cloud Storage

Expand All @@ -147,10 +147,10 @@ The bucket name must be unique. For convenience, you can name it `<YOUR_PROJECT_
Go to the code samples directory, your starting point to run more commands.

```bash
cd python-retail/samples/interactive-tutorials
cd python-docs-samples/retail/interactive-tutorials
```

1. To create the bucket and upload the JSON file, open python-retail/samples/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py file
1. To create the bucket and upload the JSON file, open python-docs-samples/retail/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py file

1. Go to the **product** directory and run the following command in the Terminal:

Expand All @@ -174,7 +174,7 @@ The bucket name must be unique. For convenience, you can name it `<YOUR_PROJECT_

### Import products to the Retail Catalog

To import the prepared products to a catalog, open python-retail/samples/interactive-tutorials/product/import_products_gcs.py file and run the following command in the Terminal:
To import the prepared products to a catalog, open python-docs-samples/retail/interactive-tutorials/product/import_products_gcs.py file and run the following command in the Terminal:

```bash
python product/import_products_gcs.py
Expand Down
2 changes: 1 addition & 1 deletion retail/interactive-tutorials/events/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import test_utils.prefixer

prefixer = test_utils.prefixer.Prefixer(
"python-retail", "samples/interactive-tutorials/product"
"python-docs-samples", "retail/interactive-tutorials/product"
)


Expand Down
2 changes: 1 addition & 1 deletion retail/interactive-tutorials/product/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import test_utils.prefixer

prefixer = test_utils.prefixer.Prefixer(
"python-retail", "samples/interactive-tutorials/product"
"python-docs-samples", "retail/interactive-tutorials/product"
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create_gcs_bucket(bucket_name=BUCKET_NAME):
create_bucket(bucket_name)

path_to_resources_dir = PurePath(
Path.home(), "cloudshell_open/python-retail/samples/interactive-tutorials/resources"
Path.home(), "cloudshell_open/python-docs-samples/retail/interactive-tutorials/resources"
)
upload_blob(bucket_name, str(path_to_resources_dir / "products.json"))
upload_blob(bucket_name, str(path_to_resources_dir / "products_some_invalid.json"))
Expand Down
4 changes: 2 additions & 2 deletions retail/interactive-tutorials/user_import_data_to_catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@

{
# Create a GCS bucket and upload the product data to the bucket
output=$(python ~/cloudshell_open/python-retail/samples/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py)
output=$(python ~/cloudshell_open/python-docs-samples/retail/interactive-tutorials/product/setup_product/products_create_gcs_bucket.py)

# Get the bucket name and store it in the env variable BUCKET_NAME
temp="${output#*The gcs bucket }"
bucket_name="${temp% was created*}"
export BUCKET_NAME=$bucket_name

# Import products to the Retail catalog
python ~/cloudshell_open/python-retail/samples/interactive-tutorials/product/import_products_gcs.py
python ~/cloudshell_open/python-docs-samples/retail/interactive-tutorials/product/import_products_gcs.py
} && {
# Print success message
echo "====================================="
Expand Down

0 comments on commit f34f89b

Please sign in to comment.