Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Commit

Permalink
fix: sleep is added to the setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
tetiana-karasova authored and t-karasova committed Mar 28, 2022
1 parent 6d0a16f commit 793a3c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions samples/interactive-tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ To run Python code samples for the Retail API tutorial, you need to set up your
```bash
pip install google
pip install google-cloud-retail
pip install google.cloud.storage
pip install google.cloud.bigquery
pip install google-cloud-storage
pip install google-cloud-bigquery
```

Expand Down
11 changes: 7 additions & 4 deletions samples/interactive-tutorials/user_environment_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# get the project_id from gcloud config
echo Project ID:
project_id=$(gcloud config get-value project)
echo $project_id
timestamp=$(date +%s)
echo $timestamp
echo Service Account:
service_account_id="service-acc-"$timestamp
echo $service_account_id

# create service account (your project_id+timestamp)
gcloud iam service-accounts create $service_account_id

# assign needed roles to your new service account
for role in {retail.admin,storage.admin,bigquery.admin}
for role in {retail.admin,editor,bigquery.admin}
do
gcloud projects add-iam-policy-binding $project_id --member="serviceAccount:"$service_account_id"@"$project_id".iam.gserviceaccount.com" --role="roles/${role}"
done
done
sleep 70

# upload your service account key file
service_acc_email=$service_account_id"@"$project_id".iam.gserviceaccount.com"
Expand All @@ -43,6 +45,7 @@ export GOOGLE_APPLICATION_CREDENTIALS=~/key.json
# install needed Google client libraries
virtualenv -p python3 myenv
source myenv/bin/activate
sleep 2

pip install google
pip install google-cloud-retail
Expand Down
3 changes: 3 additions & 0 deletions samples/interactive-tutorials/user_import_data_to_catalog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# activate the python virtual env
source ~/cloudshell_open/myenv/bin/activate

# Change the working directory
current_path=$(pwd)
temp_path="${current_path%cloudshell_open*}"
Expand Down

0 comments on commit 793a3c3

Please sign in to comment.