-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.ps1
38 lines (29 loc) · 908 Bytes
/
run.ps1
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
# parse arguments
param(
[Parameter(Mandatory=$true)]
[string]$check
)
# extract individual checks
$checks = $check.Split(" ")
Write-Host $checks
# Start the Docker containers
docker-compose up -d
# loop through the array and run the Python script for each item
foreach ($check in $checks) {
$lastName, $rewardNumber = $check.split(',')
& python main.py $lastname $rewardnumber
# Activate the Python virtual environment
$env:Path = "$pwd/venv/Scripts;" + $env:Path
. $pwd/venv/Scripts/activate.ps1
# Set the environment variables for the current pair
$env:LASTNAME = $lastName
$env:REWARDNUMBER = $rewardNumber
# Run the Python script and print the output
Write-Host "Launching $check"
$output = python scraper.py
Write-Host $output
# Deactivate the Python virtual environment
deactivate
}
# Stop the Docker containers
docker-compose down