This tutorial shows you how to use the pysftp client to move data to/from your Nimbix cloud machine.
This will be especially useful for moving data between your IBM Apache Spark service and your IBM PowerAI system available during the Hackathon.
https://pysftp.readthedocs.io/en/release_0.2.9/#
Important for hackathon participants using the PowerAI systems. When those machines are shut down, all data in your local user space will be lost. So, be sure to save your work!
BUG: It was recently found that installing pysftp breaks the python-swiftclient, which is used to transfer data to Object Storage. If you install pysftp and then wish to resume using python-swiftclient you'll need to:
In [ ]:
#!pip install --user pysftp
#restart your kernel
In [ ]:
import pysftp
In [ ]:
mydatafolder = os.environ['PWD'] + '/' + 'my_team_name_data_folder'
In [ ]:
# THIS DISABLES HOST KEY CHECKING! Should be okay for our temporary running machines though.
cnopts = pysftp.CnOpts()
cnopts.hostkeys = None
In [ ]:
#Get this from your Nimbix machine (or other cloud service provider!)
hostname='NAE-xxxx.jarvice.com'
username='nimbix'
password='xx'
In [ ]:
with pysftp.Connection(hostname, username=username, password=password, cnopts=cnopts) as sftp:
sftp.put(mydatafolder + '/zipfiles/classification_6_noise.zip') # upload file to remote
In [ ]:
fromnimbixfolder = mydatafolder + '/fromnimbix'
if os.path.exists(fromnimbixfolder) is False:
os.makedirs(fromnimbixfolder)
In [ ]:
with pysftp.Connection(hostname, username=username, password=password, cnopts=cnopts) as sftp:
with pysftp.cd(fromnimbixfolder):
sftp.get('test.csv') #data in local HOME space
sftp.get('/data/my_team_name_data_folder/our_results.csv') #data in persistent Nimbix Cloud storage