changes made accroding to issue #1

This commit is contained in:
Rishabh Saxena 2024-05-22 11:43:24 +02:00
parent 1e56496f56
commit 1eb6024fd0
4 changed files with 53 additions and 18 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
__pycache__ __pycache__
notebooks/ notebooks/
/deployment_scripts/create-env.sh /deployment_scripts/create-env.sh
/deployment_scripts/deploy-env.sh /deployment_scripts/deploy-env.sh
/deployment_scripts/environment.yaml

View file

@ -61,7 +61,21 @@ source deploy-dask.sh "$(pwd)"
## Usage ## Usage
### Single Node ### Single Node
To run the application interactively on a single node, execute the following command after all the cluster's nodes are up and running: To run the application interactively on a single node, follow points 4, 5, 6 and, 7 from [Getting Started](#getting-started), and execute the following command after all the job has started:
```bash
# Load the Conda module
module load bigdata/conda
source activate # activates the base environment
# List available Conda environments for verification purposes
conda env list
# Activate a specific Conda environment.
conda activate dask_environment # you need to execute `source activate` first, or use `source [ENV_PATH]/bin/activate`
```
After the environment is activated, you can run the python interpretor:
```bash ```bash
python python
@ -72,19 +86,13 @@ Or to run a full script:
python <your-script>.py python <your-script>.py
``` ```
Note: If you don't see your environment in the python interpretor, then manually activate it using:
```bash
conda activate <your-env>
```
Do this before using the python interpretor.
### Multiple Nodes ### Multiple Nodes
To run the application on multiple nodes, you need to write a `.pbs` script and submit it using `qsub`. Follow lines 1-4 from the [Getting Started](#getting-started) section. Write a `submit-dask-job.pbs` script: To run the application on multiple nodes, you need to write a `.pbs` script and submit it using `qsub`. Follow lines 1-4 from the [Getting Started](#getting-started) section. Write a `submit-dask-job.pbs` script:
```bash ```bash
#!/bin/bash #!/bin/bash
#PBS -N dask-job #PBS -N dask-job
#PBS -l select=3:node_type=rome-ai #PBS -l select=3:node_type=rome
#PBS -l walltime=1:00:00 #PBS -l walltime=1:00:00
#Go to the directory where the code is #Go to the directory where the code is
@ -97,6 +105,8 @@ source deploy-dask.sh "$(pwd)"
python <your-script>.py python <your-script>.py
``` ```
A more thorough example is available in the `deployment_scripts` directory under `submit-dask-job.pbs`.
And then execute the following commands to submit the job: And then execute the following commands to submit the job:
```bash ```bash

View file

@ -1,9 +0,0 @@
channels:
- defaults
- conda-forge
dependencies:
- python=3.8.18
- dask
- numpy
- scikit-learn
- conda-pack

View file

@ -0,0 +1,33 @@
#!/bin/bash
#PBS -N dask-job
#PBS -l select=2:node_type=rome
#PBS -l walltime=1:00:00
export PYTHON_FILE= # Path to the Python file you want to run
export CURRENT_WORKSPACE= # Path to the workspace where you have pulled this repo and the dask-env.tar.gz file
export ALL_NODES=$(cat $PBS_NODEFILE)
export SCHEDULER_NODE="$(head -n1 $PBS_NODEFILE)-ib"
export WORKER_NODES=$(tail -n+2 $PBS_NODEFILE)
export DASK_SCHEDULER_PORT=8786
export DASK_UI_PORT=8787
export DASK_ENV="$HOME/dask"
mkdir -p $DASK_ENV
tar -xzf $CURRENT_WORKSPACE/dask-env.tar.gz -C $DASK_ENV
chmod -R 700 $DASK_ENV
source $DASK_ENV/bin/activate
conda-unpack
dask scheduler --host $SCHEDULER_NODE --port $DASK_SCHEDULER_PORT &
export NUM_NODES=$(sort $PBS_NODEFILE |uniq | wc -l)
# Assuming you have a Dask worker script named 'dask-worker-script.py', modify this accordingly
for ((i=1;i<$NUM_NODES;i++)); do
echo "[$(date '+%Y-%m-%d %H:%M:%S') - Master] INFO: Starting Dask Worker at $i"
pbsdsh -n $i -o -- bash -l -c "source /deplyment_scripts/dask-worker.sh $CURRENT_WORKSPACE $SCHEDULER_NODE"
done
python3 $PYTHON_FILE