Prerequisites
GCP account
Open Console.
Click on activate cloud shell
$ git clone https://github.com/GoogleCloudPlatform/training-data-analyst
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-426.png)
$ ls
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-427.png)
Create bucket in console. Give bucket name as same as the project ID
In shell, execute the below command
$ BUCKET=”<bucket-name>”
$ echo $BUCKET
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-428.png)
Open Menu > API services > Library
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-429.png)
Search Dataflow. Click Dataflow API
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-430.png)
Click Enable
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-431.png)
$ cd training-data-analyst/courses/data_analysis/lab2/python
$ ls
The files will be displayed
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-432.png)
$ nano install_packages.sh #open the file install_packages.sh
![](https://prwatech.in/blog/wp-content/uploads/2021/05/10-1024x53.jpg)
The file contents can be shown. This file is to install the components.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-434.png)
$ sudo ./install_packages.sh
![](https://prwatech.in/blog/wp-content/uploads/2021/05/12-1024x40.jpg)
To check python version
$ pip-V
$ pip3 -V
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-435.png)
$ nano grep.py Open the file grep.py and check the content
![](https://prwatech.in/blog/wp-content/uploads/2021/05/14.jpg)
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-436.png)
$ python3 grep.py
![](https://prwatech.in/blog/wp-content/uploads/2021/05/16-1024x55.jpg)
$ ls /tmp #It will display whether the file is executed or not.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/17.jpg)
$ cat /tmp/output-* #It will display detailed output.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-437.png)
$ gsutil cp ../javahelp/src/main/java/com/google/cloud/training/dataanalyst/javahelp/*.java gs://$BUCKET/javahelp
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-438.png)
Check the file is saved or not.
Open Menu > Cloud Storage.
Open Bucket.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-439.png)
The file will be copied or not.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-440.png)
$ echo $DEVSHELL_PROJECT_ID $
echo $BUCKET
![](https://prwatech.in/blog/wp-content/uploads/2021/05/22-1024x82.jpg)
$ nano grepc.py
![](https://prwatech.in/blog/wp-content/uploads/2021/05/22a.jpg)
Edit the file.
PROJECT='<project_ID>’
BUCKET='<bucket_name>’
NB : If the Project ID and Bucket is same, we can give the same ID
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-442.png)
To Save and exit. Press ‘Ctrl + X’. Press ‘Y’ and ‘Enter’
$ python3 grepc.py #Execute file grepc.py
![](https://prwatech.in/blog/wp-content/uploads/2021/05/24-1024x59.jpg)
Open Console >Dataflow > Jobs
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-443.png)
Open the Job which is executed.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-444.png)
Click the Job Graph.
The Graph is displayed.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-445.png)
In Job Graph on right side you can see the Job info and resource metrics.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-446.png)
Open Shell.
$ ls
$ nano is_popular.py
![](https://prwatech.in/blog/wp-content/uploads/2021/05/30-1024x113.jpg)
It will open the file is_popular.py
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-447.png)
$ python3 ./is_popular.py #To execute theis_popular.py file
$ cat /tmp/output-* #Display the output
![](https://prwatech.in/blog/wp-content/uploads/2021/05/31-1024x67.jpg)
$ python3 ./is_popular.py –output_prefix=/tmp/myoutput
![](https://prwatech.in/blog/wp-content/uploads/2021/05/32-1024x37.jpg)
$ nano /tmp/myoutput-00000-of-00001
![](https://prwatech.in/blog/wp-content/uploads/2021/05/36.jpg)
It will open the file with output.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/33-1024x79.jpg)
Open Menu > Cloud Storage.
Open Bucket.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-448.png)
Open javahelp/ folder
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-449.png)
The outputs will be stored in it.
![](https://prwatech.in/blog/wp-content/uploads/2021/05/image-450.png)