# natscale

A high-performance Python framework for HPC task distribution, load balancing, and monitoring powered by NATS.

# Install NATS
## deploy a NATS service

``` sh
go install github.com/nats-io/nats-server/v2@latest

export PATH=$PATH:$(go env GOPATH)/bin

# -js 表示开启 JetStream 持久化功能
# -m 8222 (可选) 开启 HTTP 监控面板，方便在浏览器看状态
nats-server -js
```

## create a NATS stream

``` sh
nats stream add NATSCALE --subjects "hpc.tasks.>" --storage=file --ack --retention=work --discard new   --max-msgs 100000 --replicas 1
```

## useful commands

check the stream info
``` sh
watch -n 10 nats stream info NATSCALE
```


view the stream graph
``` sh
nats stream graph
```


# template-pdm-base

This project is generated by pdm template of https://github.com/POFK/template-pdm-base by command:
```
pdm init https://github.com/POFK/template-pdm-base <project_name>
```

also a non-interactive command is:
```
pdm init --name <project_name> --dist -n  https://github.com/POFK/template-pdm-base
```

# first run after initialization
```
pdm install
detect-secrets scan > .secrets.baseline

git add .
pre-commit run -a
```
