forked from zayn303/tv-program-web-scraper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsjob_NatGeo.slurm
More file actions
54 lines (44 loc) · 1.42 KB
/
sjob_NatGeo.slurm
File metadata and controls
54 lines (44 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#SBATCH --job-name=tvprog-scrape-NatGeo
#SBATCH --time=01:00:00
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=8G
#SBATCH --output=logs/%x_%j.out # per-job stdout
#SBATCH --error=logs/%x_%j.err # per-job stderr
# #SBATCH --mail-type=FAIL,END
# #SBATCH --mail-user=you@example.com
set -euo pipefail
# Always start where the job was submitted
cd "$SLURM_SUBMIT_DIR"
# Ensure the logs directory exists *before* we write anything there
mkdir -p logs
#################################
# Virtual environment (your way)
#################################
# Your settings:
VENV_DIR="./home/ak562fx/ss"
# Create/activate + install deps (mirrors your script)
if [ ! -d "$VENV_DIR" ]; then
echo "Creating virtual environment in $VENV_DIR ..."
python3 -m venv "$VENV_DIR"
fi
echo "Activating virtual environment ..."
# shellcheck disable=SC1090
source "$VENV_DIR/bin/activate"
echo "Upgrading pip ..."
pip install --upgrade pip
if [ -f requirements.txt ]; then
echo "Installing requirements ..."
pip install -r requirements.txt
else
echo "requirements.txt not found, skipping install."
# Minimal deps for your script:
pip install requests beautifulsoup4 > /dev/null || true
fi
############################
# Run the scraper script #
############################
# Update the script name if yours differs
python scraper_NatGeo.py
echo "Done. Check logs/ and tv_programs_NatGeo.txt in $SLURM_SUBMIT_DIR."