NBX-Build Instances are APIs to your machines. These APIs can be used to change state of the machine (start, stop, etc.), can be used to transfer files to and from the machine (using
Instance.mv commands), calling any shell command using
Build comes built in with several functions to move and list files from the instance. All you need to know is that cloud files have prefix
nbx:// which is where your projects are. Here's a quick list:
# move files nbx build -i 'instance_name' --workspace_id 'workspace_id' mv ./local_file nbx://cloud_file # or move folders nbx build -i 'instance_name' --workspace_id 'workspace_id' mv ./local_folder nbx://in_this/folder/
You might be required to agree to the SSH connection being setup. If you want to avoid that set
NBOX_SSH_NO_HOST_CHECKING=1. All these APIs are also available in python.
- fields -
fields to print. Defaults to . If not provided all fields will be printed.
Print complete status of NBX-Build instances. If
workspace_id is not provided personal workspace will be used. Used in CLI
- i -
project_idof the instance
NBX-Build Instance class manages the both individual instance, but provides webserver functionality using
nbox_ws_v1, such as starting and stopping, deletion and more.
- project_name -
Name of the instance
- storage_limit -
Storage limit in GB. Defaults to 25.
- project_type -
Type of the instance. Defaults to "blank".
- github_branch -
Branch of the github repo. Defaults to "".
- github_link -
Link to the github repo. Defaults to "".
- template_id -
ID of the template to use. Defaults to 0.
- clone_id -
ID of the instance to clone. Defaults to 0.
Create a new NBX-Build instance.
Instance: The newly created instance.
- subdomain -
The subdomain to connect to
Get a Subway object for the instance.
Subway: The Subway object.
Check if the instance is running.
bool: True if the instance is running, False otherwise.
Update the data, get latest state
Turn on the the unserlying compute
- cpu -
CPU count should be one of
[2, 4, 8]
- gpu -
GPU name should be one of
["t5", "p100", "v100", "k80"]
- gpu_count -
When zero, cpu-only instance is started
- auto_shutdown -
No autoshutdown if zero, defaults to 6.
- dedicated_hw -
If not spot/pre-emptible like machines used
- zone -
GCP cloud regions, defaults to "asia-south-1".
Start instance if not already running and loads APIs from the compute server. Actual start is implemented in
_start method, this combines other things
Stop the Instance
With great power comes great responsibility.
This function is used to create a the Connection Manager object and not depend on
__create_threads from ssh
- path -
Path to list files in all paths will be built relative to "/home/ubuntu/project/" folder.
List files in a directory relative to '/home/ubuntu/project'
[nbox API] - nbox.Instance(...).ls("/") [nbox CLI] - nbx build ... ls ./
- src -
Source file or folder to move
- dst -
Destination file or folder to move to
- force -
If True, will override the destination file if it already exists
Move files to and fro NBX-Build. Use 'nbx://' as prefix for Instance, all files will be placed relative to '/home/ubuntu/project/' folder.
- file -
File to remove
Remove file from NBX-Build.
- x -
Command to run
Run any command using SSH, in the underlying system it will setup a SSH connection and execute any command.
EXPERIMENTAL: FEATURES MIGHT BREAK Caller is the most important UI/UX. The letter
x in programming is reserved the most arbitrary thing, and this
nbox.Instance is the gateway to a cloud instance. You can:
- run a script on the cloud
- run a local script on the cloud
- get the status of a script
- [TBD] run a special kind of functions known as
pure functions <https://en.wikipedia.org/wiki/Pure_function>_
Pure functions in programming are functions that are self sufficient in terms of execution, eg. all the packages are imported inside the function and there are no side effects in an execution (seeds included for probabilistic functions). Writing such functions in python with any IDE with checker is dead easy, however the performace guarantee is premium given high costs. Thus the logic to parsing these will have to be written as a seperate module.