Installation¶
Prerequisites¶
Python 3.10+
PostgreSQL (for Prefect Orion database)
Setting up PostgreSQL¶
Install PostgreSQL:
macOS (Homebrew):
brew install postgresql brew services start postgresql
Linux (Debian/Ubuntu):
sudo apt-get update && sudo apt-get install -y postgresql postgresql-contrib sudo service postgresql start
Windows: Download and run the PostgreSQL installer and follow the prompts.
Create a PostgreSQL User and Database:
psql postgres
Windows: Download and run the PostgreSQL installer and follow the prompts.
Create a PostgreSQL User and Database:
psql postgres
Inside the
psql
prompt:CREATE USER prefect_user WITH PASSWORD 'pass'; CREATE DATABASE prefect_db OWNER prefect_user; GRANT ALL PRIVILEGES ON DATABASE prefect_db TO prefect_user;
Exit with
\q
.
Installing nxbench¶
From PyPi:
pip install nxbench
From a local clone:
git clone https://github.com/dpys/nxbench.git
cd nxbench
make install
Setting up Prefect Orion¶
In a terminal window:
Export environment variables pointing to your PostgreSQL database:
export PREFECT_API_DATABASE_CONNECTION_URL="postgresql+asyncpg://prefect_user:pass@localhost:5432/prefect_db" export PREFECT_ORION_DATABASE_CONNECTION_POOL_SIZE="5" export PREFECT_ORION_DATABASE_CONNECTION_MAX_OVERFLOW="10" export PREFECT_ORION_API_ENABLE_TASK_RUN_DATA_PERSISTENCE="false" export PREFECT_API_URL="<http://127.0.0.1:4200/api>"
Start the Orion server:
prefect orion start
By default it will run on
http://127.0.0.1:4200
.
Installation (Docker Setup)¶
# CPU-only
make build
# With GPU
make build-gpu
Development Setup¶
Install development dependencies (testing and documentation):
pip install -e .[test,doc]
Run tests:
make test