-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·49 lines (38 loc) · 1.31 KB
/
run.sh
File metadata and controls
executable file
·49 lines (38 loc) · 1.31 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
#!/usr/bin/env -S bash --login
set -euo pipefail
# This script is the one that is called by the DPS.
# Use this script to prepare input paths for any files
# that are downloaded by the DPS and outputs that are
# required to be persisted
# Get current location of build script
basedir=$(dirname "$(readlink -f "$0")")
# Create output directory to store outputs.
# The name is output as required by the DPS.
# Note how we dont provide an absolute path
# but instead a relative one as the DPS creates
# a temp working directory for our code.
mkdir -p output
# DPS downloads all files provided as inputs to
# this directory called input.
# In our example the image will be downloaded here.
INPUT_DIR=input
OUTPUT_DIR=output
source="$1"
region="${2:-}"
# Call the script using the absolute paths
# Use the updated environment when calling 'uv run'
# This lets us run the same way in a Terminal as in DPS
# Any output written to the stdout and stderr streams will be automatically captured and placed in the output dir
# unset PROJ env vars
unset PROJ_LIB
unset PROJ_DATA
# Build command arguments
args=(
--source="${source}"
--output_dir="${OUTPUT_DIR}"
)
# Only add --region if it was provided
if [ -n "$region" ]; then
args+=(--region="${region}")
fi
UV_PROJECT=${basedir} uv run --no-dev ${basedir}/main.py "${args[@]}"