Execute processes and commands
Set up authentication to Blaxel
Set up authentication to Blaxel
The Blaxel SDK authenticates with your workspace using credentials from these sources, in priority order:
- when running on Blaxel, authentication is handled automatically
- variables in your
.envfile (BL_WORKSPACEandBL_API_KEY, or see this page for other authentication options). - environment variables from your machine
- configuration file created locally when you log in through Blaxel CLI (or deploy on Blaxel)
Execute command
Execute shell commands using the TypeScript SDK:waitForCompletion: true / "wait_for_completion": True parameter.
Use process names
When starting a process (running a command), you can specify a process name. This lets you interact with the processβsuch as retrieving logs or process informationβwithout needing to store the process ID on your end.exitCode parameter of the process execution object returned by the process.exec and process.get methods.
You can also use the process ID or name to retrieve logs of your processes.
Wait for process completion
You can wait for process completion when executing it:.logs object which surfaces both stdout and stderr. Also, notice the timeout parameter which allows to set a timeout duration on the process.
You can also wait for a process after it has started:
Wait for ports
In some cases, you may want to wait for a port to be opened while running β for example if you are runningnpm run dev and want to wait for port 3000 to be open.
Kill process
Kill a process immediately by running:Process statuses
A process can have either of the following status:runningcompletedfailedkilledstopped
