Running a python script on Google Cloud Compute Engine

Viewed 53100

For a machine learning task at school I wrote my own MLP network. The data set is quite big, and training takes forever. I was alerted to the option of running my script on the Google Cloud Compute Engine. I tried to set this up, but did not succeed (yet).

The steps I undertook where:

  1. Create an account
  2. Create a VM
  3. Open the VM via the browser

Can anyone help me with importing and running my python script into the Google Cloud. Or does anyone have clear a tutorial on how to solve this? I tried finding these myself, but had no success so far.

5 Answers

There is even a simpler approach to to run code in the background in gcp and in every linux terminal: using screen linux

Create a new background terminal window:

screen -S WRITE_A_NAME_OF_YOUR_CHOIC_HERE

now you are in a background window in the terminal. Run your code:

python3 mycode.py

Exit screen with the hotkeys and the job will keep running on the background.

ctrl + A + D

You can close all windows now. If you wanna go back and see what's happening. Log again in your terminal. And tap the following.

screen -ls 

This one will give you the list of the created "windows". Now find yours and tap

screen -r WRITE_NAME_OF_YOUR_WINDOW

And there you have it :D You can find more commands here

Just navigate to the directory where the script is placed.

python thenameofscript.py

I used Way Script which is great and have a free plan to run every hour

You can check this video to see explanation

Related