Skip to content

Commit

Permalink
rename CLI tool as bacc
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarshayachit committed Oct 9, 2023
1 parent 76eec9a commit be39aa1
Show file tree
Hide file tree
Showing 23 changed files with 159 additions and 146 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ jobs:
pip install ./cli
- name: Basic validation tests
run: |
sb --help
bacc --help
- name: Group 'pool' validation tests
run: |
sb pool --help
sb pool list --help
sb pool resize --help
bacc pool --help
bacc pool list --help
bacc pool resize --help
- name: Command 'show' validation tests
run: |
sb show --help
bacc show --help
- name: Command 'azfinsim' validation tests
run: |
sb azfinsim --help
bacc azfinsim --help
2 changes: 2 additions & 0 deletions cli/bin/bacc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
python3 -m bacc "$@"
2 changes: 0 additions & 2 deletions cli/bin/sb

This file was deleted.

6 changes: 3 additions & 3 deletions cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[tool.poetry]
name = "az-sbatch"
name = "bacc"
version = "0.1.0"
description = ""
authors = ["Utkarsh Ayachit <uayachit@microsoft.com>"]
packages = [{include = "az_sbatch", from = "src"}]
packages = [{include = "bacc", from = "src"}]

[tool.poetry.dependencies]
python = "^3.8"
Expand All @@ -15,7 +15,7 @@ azure-mgmt-resource = "^23.0.0"
pyjson5 = "^1.6.2"

[tool.poetry.scripts]
sb = {reference = "bin/sb", type = "file"}
bacc = {reference = "bin/bacc", type = "file"}

[build-system]
requires = ["poetry-core"]
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions cli/src/az_sbatch/__main__.py → cli/src/bacc/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from knack import CLI
from .commands import CommandsLoader

name = "sb"
name = "bacc"
message = r"""
Welcome to CLI for sbatch: an Azure Batch accelerator
Welcome to CLI for BAcc: an Azure Batch accelerator
"""
cli = CLI(
cli_name=name,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/az_sbatch/azfinsim.py → cli/src/bacc/azfinsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def populate_commands(loader):
with CommandGroup(loader, "", "az_sbatch.azfinsim#{}") as g:
with CommandGroup(loader, "", "bacc.azfinsim#{}") as g:
g.command("azfinsim", "execute")


Expand Down
4 changes: 2 additions & 2 deletions cli/src/az_sbatch/commands.py → cli/src/bacc/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class CommandsLoader(CLICommandsLoader):
"""Commands loader for the sbatch module."""

def load_command_table(self, args):
with CommandGroup(self, "", "az_sbatch.commands#{}") as g:
with CommandGroup(self, "", "bacc.commands#{}") as g:
g.command("show", "show")
with CommandGroup(self, "pool", "az_sbatch.commands#pool_{}") as g:
with CommandGroup(self, "pool", "bacc.commands#pool_{}") as g:
g.command("list", "list")
g.command("resize", "resize")
g.command("show", "show")
Expand Down
4 changes: 2 additions & 2 deletions cli/src/az_sbatch/mpi_bm.py → cli/src/bacc/mpi_bm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
"""

def populate_commands(loader):
with CommandGroup(loader, "", "az_sbatch.mpi_bm#{}") as g:
with CommandGroup(loader, "", "bacc.mpi_bm#{}") as g:
g.command("mpi-bm", "imb")

def populate_commands(loader):
with CommandGroup(loader, "mpi-bm", "az_sbatch.mpi_bm#{}") as g:
with CommandGroup(loader, "mpi-bm", "bacc.mpi_bm#{}") as g:
g.command("imb", "imb")
g.command("osu", "osu")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@


def populate_commands(loader):
with CommandGroup(loader, "json", "az_sbatch.tools_json#{}") as g:
with CommandGroup(loader, "json", "bacc.tools_json#{}") as g:
g.command("concat", "concat")
g.command("strip", "strip")

Expand Down
File renamed without changes.
44 changes: 22 additions & 22 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ source env0/bin/activate
pip install ./cli

# verify the CLI tool is installed
sb --help
bacc --help
```

If you don't want to use a virtual environment, you can install the CLI tool globally using the following command.
Expand All @@ -51,46 +51,46 @@ cd azbatch-starter
pip install ./cli

# verify that the CLI tools are installed
sb --help
bacc --help
```

## Usage

Once the CLI is installed, you can use the `sb ...` command to interact with the `sbatch`.
Once the CLI is installed, you can use the `bacc ...` command to interact with the `sbatch`.
The commands have the following format:

```sh
> sb [command] [subcommand] [parameters]
> bacc [command] [subcommand] [parameters]
```

You can use `--help` to get help on the commands and subcommands.

```sh
# `--help` shows all available commands
> sb --help
> bacc --help

Group
sb
bacc

Subgroups:
pool : Manage batch pools.

Commands:
azfinsim : Execute the azfinsim demo.
show : Show the configuration of the sbatch deployment.
show : Show the configuration of the baccatch deployment.
```

### `sb show`
### `bacc show`

`sb show` command can be used to get information about the deployment. This is useful to get
`bacc show` command can be used to get information about the deployment. This is useful to get
information about the batch account, storage account, container registry etc. that are created as part of the deployment.

```sh
> sb show --help
> bacc show --help

Command
sb show : Show the configuration of the sbatch deployment.
Shows the configuration details of the sbatch deployment. This is useful
bacc show : Show the configuration of the sbatch deployment.
Shows the configuration details of the baccatch deployment. This is useful
to get access to various resources and endpoints for resources that
are used for management and trying of the demos.

Expand All @@ -113,30 +113,30 @@ Global Arguments
logs.
```

### `sb pool`
### `bacc pool`

`sb pool` subcommands can be used to manage the pools in the deployment.
`bacc pool` subcommands can be used to manage the pools in the deployment.

```sh
> sb pool --help
> bacc pool --help

Group
sb pool : Manage batch pools.
bacc pool : Manage batch pools.
Commands to manage batch pools.

Commands:
list : List the pools in the batch account.
resize : Resize the pool.
```

`sb pool list` returns a list of names for the pool setup on the batch account. Unless changed manually after deployment,
`bacc pool list` returns a list of names for the pool setup on the batch account. Unless changed manually after deployment,
these will match the names specified in `batch.jsonc` configuration file.

```sh
> sb pool list --help
> bacc pool list --help

Command
sb pool list : List the pools in the batch account.
bacc pool list : List the pools in the batch account.
Lists the pools in the batch account.

Arguments
Expand All @@ -157,15 +157,15 @@ Global Arguments
logs.
```

`sb pool resize` can be used to resize a pool. Unlike `az batch pool resize ..` commands, this command waits until
`bacc pool resize` can be used to resize a pool. Unlike `az batch pool resize ..` commands, this command waits until
the resize is complete (unless `--no-wait` is specified). `--await-compute-nodes` can be used to wait until
not only the allocation of the compute nodes, but also their startup and other initialization.

```sh
> sb pool resize --help
> bacc pool resize --help

Command
sb pool resize : Resize the pool.
bacc pool resize : Resize the pool.

Arguments
--pool-id -p [Required] : The ID of the pool to resize.
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/azfinsim-in-secured-batch.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ a virtual network and a batch account.

## Design Considerations

* **Private endpoints**: All resources deployed by `sbatch` are accessible only via private endpoints. Network security
* **Private endpoints**: All resources deployed by bacc are accessible only via private endpoints. Network security
rules prohibit access from public networks using Azure-provided name resolution. This includes storage accounts,
key vaults, batch accounts, etc. This adds additional complexity when accessing these resources from your workstation, for
example, but it is a necessary trade-off for a secure deployment.
Expand Down Expand Up @@ -130,7 +130,7 @@ The only differences being the following:

Experienced users will soon realize that even this logging in to Azure CLI on the jumpbox is not required.
This is only necessary for the few commands we execute in the tutorial steps viz. obtaining the subscription ID.
You can skip these CLI login steps and instead manually provide the subscription ID in the `sb ...` commands.
You can skip these CLI login steps and instead manually provide the subscription ID in the `bacc ...` commands.

[examples/secured-batch]: https://github.com/utkarshayachit/azbatch-starter/tree/main/examples/secured-batch
[azbatch-starter-connectivity]: https://github.com/mocelj/azbatch-starter-connectivity
20 changes: 10 additions & 10 deletions docs/tutorials/azfinsim-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ AZ_SUBSCRIPTION_ID=$(az account show --query id -o tsv)
# set resource group name to the one used in Step 2
AZ_RESOURCE_GROUP=azfinsim0 # or whatever you used in Step 2

# use the `sb show` command
sb show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP
# use the `bacc show` command
bacc show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP
# on success, you'll get the following output
{
"acr_name": null,
Expand All @@ -102,8 +102,8 @@ sb show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP
# if you deployed with `enableApplicationContainers=true` parameter, then the `acr_name`
# will be a valid URL instead of `null`.

# To list all available pools, use the `sb pool list` command
sb pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
# To list all available pools, use the `bacc pool list` command
bacc pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
--query "[].{pool_id:id, vm_size:vmSize, state:allocationState}"
# expected output
[
Expand All @@ -122,12 +122,12 @@ We can now submit the AzFinSim job to the pool.
```bash
#!/bin/bash

AZ_POOL_ID=$(sb pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
AZ_POOL_ID=$(bacc pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
# --- or you can just manually set AZ_POOL_ID to "linux", of course!

# submit the job to generate 1000 trades, and process them using 100 concurrent tasks;
# here, we use the container image "utkarshayachit/azfinsim:main" from Docker Hub
sb azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
bacc azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
-p $AZ_POOL_ID \
--num-trades 1000 \
--num-tasks 100 \
Expand All @@ -148,7 +148,7 @@ change this as follows.

```bash
# resize pool
sb pool resize -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP -p $AZ_POOL_ID --target-dedicated-nodes 1
bacc pool resize -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP -p $AZ_POOL_ID --target-dedicated-nodes 1
# this will block until the pool is resized and then print the following:
{
"current_dedicated_nodes": 1,
Expand Down Expand Up @@ -177,7 +177,7 @@ But first, we need to push the container image for the AzFinSim application to t
# fetch acr name from the deployment;
# you can also use Azure Portal to navigate to the resource group and get the
# Azure Container Registry resource name manually
ACR_NAME=$(sb show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "acr_name")
ACR_NAME=$(bacc show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "acr_name")

# NOTE: ACR_NAME is valid only when deployed with `enableApplicationContainers=true` parameter

Expand Down Expand Up @@ -207,12 +207,12 @@ use the ACR we created in the deployment.
```bash
#!/bin/bash

AZ_POOL_ID=$(sb pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
AZ_POOL_ID=$(bacc pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
# --- or you can just manually set AZ_POOL_ID to "linux", of course!

# submit the job to generate 1000 trades, and process them using 100 concurrent tasks;
# here, we use the container image "utkarshayachit/azfinsim:main" from Docker Hub
sb azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
bacc azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
-p $AZ_POOL_ID \
--num-trades 1000 \
--num-tasks 100 \
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/azfinsim-windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ AZ_SUBSCRIPTION_ID=$(az account show --query id -o tsv)
# set resource group name to the one used in Step 2
AZ_RESOURCE_GROUP=azfinsim0 # or whatever you used in Step 2

# use the `sb show` command
sb show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP
# use the `bacc show` command
bacc show -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP
# on success, you'll get the following output
{
"acr_name": null,
"batch_endpoint": "https://......batch.azure.com"
}

# To list all available pools, use the `sb pool list` command
sb pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
# To list all available pools, use the `bacc pool list` command
bacc pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
--query "[].{pool_id:id, vm_size:vmSize, state:allocationState}"
# expected output
[
Expand All @@ -98,11 +98,11 @@ We can now submit the AzFinSim job to the pool.
```bash
#!/bin/bash

AZ_POOL_ID=$(sb pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
AZ_POOL_ID=$(bacc pool list -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP --query "[0].id" -o tsv)
# --- or you can just manually set AZ_POOL_ID to "linux", of course!

# submit the job to generate 1000 trades, and process them using 100 concurrent tasks;
sb azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
bacc azfinsim -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP \
-p $AZ_POOL_ID \
--mode package \
--num-trades 1000 \
Expand All @@ -122,7 +122,7 @@ change this as follows.

```bash
# resize pool
sb pool resize -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP -p $AZ_POOL_ID --target-dedicated-nodes 1
bacc pool resize -s $AZ_SUBSCRIPTION_ID -g $AZ_RESOURCE_GROUP -p $AZ_POOL_ID --target-dedicated-nodes 1
# this will block until the pool is resized and then print the following:
{
"current_dedicated_nodes": 1,
Expand Down
Loading

0 comments on commit be39aa1

Please sign in to comment.