diff --git a/README.md b/README.md index 9dcbfbb..41ad9bc 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,26 @@ the creation of valuable datasets for the community's miners. To learn more about the Bittensor validation process, check out this [documentation](https://tensor-wiki.vercel.app/validating/validating). +# Running + +These validators are designed to run and update themselves automatically. To run a validator, follow these steps: + +1. Install this repository, you can do so by following the steps outlined in [the installation section](#install). +2. Install [Weights and Biases](https://docs.wandb.ai/quickstart) and run `wandb.init()` within this repository. This will initialize Weights and Biases, enabling you to view KPIs and Metrics on your validator. +3. Install [PM2](https://pm2.io/docs/runtime/guide/installation/) and the [`jq` package](https://jqlang.github.io/jq/) on your system. + **On Linux**: + ```bash + sudo apt update && sudo apt install jq + ``` + **On Mac OS** + ```bash + brew update && brew install jq + ``` +4. Run the `run.sh` script which will handle running your validator and pulling the latest updates as they are issued. + ```bash + $ pm2 start autorun.sh -- script validators/openvalidators/neuron.py --wallet.name --wallet.hotkey + ``` + # Usage There are currently four main avenues for engaging with this repository: diff --git a/run.sh b/run.sh index dc4254e..48fdbbe 100755 --- a/run.sh +++ b/run.sh @@ -8,8 +8,6 @@ args=() version_location="./openvalidators/__init__.py" version="__version__" -args=$@ - # Check if pm2 is installed if ! command -v pm2 &> /dev/null then @@ -149,10 +147,27 @@ strip_quotes() { # Parse command line arguments while [[ "$#" -gt 0 ]]; do case $1 in - --script) script="$2"; shift ;; - --name) name="$2"; shift ;; - --*) shift ;; - *) shift ;; + --script) + script="$2"; + shift ;; + --name) + name="$2" + shift ;; + --*) + flag="$1"; + echo "flag is: $flag" + value="$2"; + if [[ $value == *"--"* ]]; then + value="True"; + args+=("$flag=$value"); + else + args+=("$flag=$value"); + shift; + fi + ;; + *) + echo "Unknown parameter passed" + shift ;; esac shift done @@ -178,6 +193,7 @@ fi # Run the Python script with the arguments using pm2 echo "Running $script with the following arguments with pm2:" +echo "pm2 start $script --name $proc_name --interpreter python3 -- ${args[@]}" pm2 start "$script" --name $proc_name --interpreter python3 -- "${args[@]}" # Check if packages are installed.