In this tutorial, we will show you how to launch multiple Scalable Compute nodes using the Neocortix Cloud Services Script Interface. From the previous tutorial, you should already have been able to launch a single Scalable Compute node using the Web Interface.
We assume that you are using a Linux machine, or a Virtual Linux Machine (i.e., Windows Subsystem for Linux or Oracle VirtualBox). (Note that on many Linux machines, you may need to use the command
python3
instead of
python
.)
First, please follow the steps in the tutorial Setting Up For Batch Jobs. This will ensure that your environment has all dependencies.
In the next step, we will be downloading the ncs.py Python script from our git repository at https://github.com/neocortix/ncscli.git. First, cd to the directory to which you would like to download the code. Then, to download the code, issue the command
git clone https://github.com/neocortix/ncscli.git
Now you will go down into the
ncscli/ncscli
directory, by issuing the
cd ncscli/ncscli
command, as shown below. Listing the contents of the directory with the
ls
command reveals the
ncs.py
program in that directory, which you will be using to launch your Scalable Compute nodes.
But first you will need to get your Authorization Token, which will allow our system to identify who is running the script. To get your Authorization Token (authToken), first go to the Neocortix Cloud Services page, at https://cloud.neocortix.com. Login with your username and password if necessary, and then you should see the Dashboard page (below). Click on the "Profile" card, as shown in Red:
This will take you to the Profile page (below). Click on the Gear button, as shown in Red, and then click on the "Auth Tokens" pull-down menu item, as shown in Green:
By default, Auth Tokens are disabled. To enable Auth Tokens, click on the slider switch, as shown in Red.
Now your Authorization Token, (also called API Token or authToken) is revealed - a long random string of letters and numbers. You can copy it to the clipboard by clicking on the Copy icon, as shown in Red:
Now you have everything you need to launch multiple nodes using the
ncs.py
script. On this first try, we will just launch 2 nodes. Go back to your shell window, and enter the following command line:
python ncs.py sc launch --authToken PasteYourAuthTokenHere --count 2 --showPasswords --json --encryptFiles False
as shown outlined in Red, below:
(Again, note that on many Linux machines, you may need to use the command
python3
instead of
python
.)
The system will start to generate diagnostic messages as it launches your two nodes. Typically, it will take a couple of minutes for both nodes to complete their launch. When it is finished, you will see the "Created 2 Instances" message, as shown in Blue above. And the last two long lines outlined in Green are the returned properties of your instances, such as port, user name, password, and instance ID, as you have already seen in the previous tutorial using the Web Interface.
Congratulations, you have just launched 2 Scalable Compute nodes using the Script method! And of course, we call this "Scalable Compute", because with this method, you can launch a huge number of nodes this way.
Finally, you can check on the status of your two running instances, using the "list" command:
python ncs.py sc list --authToken PasteYourAuthTokenHere
And you can terminate your two running instances, using the "terminate" command twice:
python ncs.py sc terminate --authToken PasteYourAuthTokenHere --instanceID PasteYourInstanceID1Here python ncs.py sc terminate --authToken PasteYourAuthTokenHere --instanceID PasteYourInstanceID2Here
Here, we show a "list" command (in Red, below), to verify that we have two running instances, and to get their instanceIDs. Then we show two "terminate" commands (in Green, below) to terminate the two instances using their instanceIDs. And then finally, we show another "list" command (in Blue below), to verify that the instances are no longer running.
Congratulations! You have launched two Scalable Compute Nodes, verified that they are running, terminated them, and verified that they are terminated, all using the ncs.py Script Interface!