Reputation: 35
The problem is my local internet connection is unstable, I could run the code through Jupyter to the interactive google cloud platform vertexAI, while it seems that there're always outputs returns back to the Jupyter interface. So when my local internet connection is interrupted, the code running is also interrupted.
Is there any methods that I could let the codes just run on the vertexAI backends? Then outputs could be written in the log file at last.
This could be a very basic question. Thanks.
Upvotes: 1
Views: 2201
Reputation: 7287
To be able to run your notebook on the background, I did the following steps:
nohup jupyter nbconvert --to notebook --execute test.ipynb &
nohup
and &
is added so that the command will run on the backgroundjupyter nbconvert --to notebook --execute test.ipynb
to execute the notebook specified after --execute
. --to notebook
will create a new notebook that contains the executed notebook with its logs.For testing I made notebook (test.ipynb) that has a loop that runs for 1.5 hours, that should emulate a long process.
import time
for x in range(1,1080):
print(x)
time.sleep(5)
I ran the command provided above and closed my notebook and anything related to GCP. After 1.5 hours I opened the notebook and terminal says its done.
Terminal upon checking back after 1.5 hours:
Content of nohup.out:
It created a new notebook named "test.nbconvert.ipynb" that contains the code from test.ipynb and its output.
Snippet of test.nbconvert.ipynb as seen below. It completed the loop up to 1080 iterations that took 1.5 hours:
Upvotes: 2