Skip to content

Commit 5dd9398

Browse files
authored
Tests and docs for ability to specify subdirectory to download for LocalizePath (#6308)
* Added custom localization tests for s3 and azure, added docs
1 parent bbbcad7 commit 5dd9398

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

docs/user_guide/model_repository.md

+46
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,19 @@ $ gsutil iam ch allUsers:objectViewer "${BUCKET_URL}"
142142
$ gsutil iam ch allUsers:legacyBucketReader "${BUCKET_URL}"
143143
```
144144

145+
By default, Triton makes a local copy of a remote model repository in
146+
a temporary folder, which is deleted after Triton server is shut down.
147+
If you would like to control where remote model repository is copied to,
148+
you may set the `TRITON_GCS_MOUNT_DIRECTORY` environment variable to
149+
a path pointing to the existing folder on your local machine.
150+
151+
```bash
152+
export TRITON_GCS_MOUNT_DIRECTORY=/path/to/your/local/directory
153+
```
154+
155+
**Make sure, that `TRITON_GCS_MOUNT_DIRECTORY` exists on your local machine
156+
and it is empty.**
157+
145158
#### S3
146159

147160
For a model repository residing in Amazon S3, the path must be
@@ -177,6 +190,19 @@ If the environment variables are set they will take a higher priority
177190
and will be used by Triton instead of the credentials set using the
178191
aws config command.
179192

193+
By default, Triton makes a local copy of a remote model repository
194+
in a temporary folder, which is deleted after Triton server is shut down.
195+
If you would like to control where remote model repository is copied to,
196+
you may set the `TRITON_AWS_MOUNT_DIRECTORY` environment variable to
197+
a path pointing to the existing folder on your local machine.
198+
199+
```bash
200+
export TRITON_AWS_MOUNT_DIRECTORY=/path/to/your/local/directory
201+
```
202+
203+
**Make sure, that `TRITON_AWS_MOUNT_DIRECTORY` exists on your local machine
204+
and it is empty.**
205+
180206
#### Azure Storage
181207

182208
For a model repository residing in Azure Storage, the repository path
@@ -196,6 +222,19 @@ here's an example of how to find a key corresponding to your `AZURE_STORAGE_ACCO
196222
$ export AZURE_STORAGE_ACCOUNT="account_name"
197223
$ export AZURE_STORAGE_KEY=$(az storage account keys list -n $AZURE_STORAGE_ACCOUNT --query "[0].value")
198224
```
225+
By default, Triton makes a local copy of a remote model repository in
226+
a temporary folder, which is deleted after Triton server is shut down.
227+
If you would like to control where remote model repository is copied to,
228+
you may set the `TRITON_AZURE_MOUNT_DIRECTORY` environment variable to a path
229+
pointing to the existing folder on your local machine.
230+
231+
```bash
232+
export TRITON_AZURE_MOUNT_DIRECTORY=/path/to/your/local/directory
233+
```
234+
235+
**Make sure, that `TRITON_AZURE_MOUNT_DIRECTORY` exists on your local machine
236+
and it is empty.**
237+
199238

200239
### Cloud Storage with Credential file (Beta)
201240

@@ -258,6 +297,13 @@ If the `TRITON_CLOUD_CREDENTIAL_PATH` environment variable is not set, the
258297
[Cloud Storage with Environment variables](#cloud-storage-with-environment-variables)
259298
will be used.
260299

300+
### Caching of Cloud Storage
301+
302+
Triton currently doesn't perform file caching for cloud storage.
303+
However, this functionality can be implemented through
304+
[repository agent API](https://github.com/triton-inference-server/server/blob/bbbcad7d87adc9596f99e3685da5d6b73380514f/docs/customization_guide/repository_agents.md) by injecting a proxy, which checks a specific local directory for caching
305+
given the cloud storage (original path) of the model,
306+
and then decides if cached files may be used.
261307

262308
## Model Versions
263309

qa/L0_storage_S3/test.sh

+41
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,45 @@ set -e
292292
kill $SERVER_PID
293293
wait $SERVER_PID
294294

295+
# Test localization to a specified location
296+
export TRITON_AWS_MOUNT_DIRECTORY=`pwd`/aws_localization_test
297+
298+
if [ -d "$TRITON_AWS_MOUNT_DIRECTORY" ]; then
299+
rm -rf $TRITON_AWS_MOUNT_DIRECTORY
300+
fi
301+
302+
mkdir -p $TRITON_AWS_MOUNT_DIRECTORY
303+
304+
SERVER_LOG=$SERVER_LOG_BASE.custom_localization.log
305+
SERVER_ARGS="--model-repository=$ROOT_REPO --exit-timeout-secs=120"
306+
307+
run_server
308+
if [ "$SERVER_PID" == "0" ]; then
309+
echo -e "\n***\n*** Failed to start $SERVER\n***"
310+
cat $SERVER_LOG
311+
exit 1
312+
fi
313+
314+
if [ -z "$(ls -A $TRITON_AWS_MOUNT_DIRECTORY)" ]; then
315+
echo -e "\n***\n*** Test localization to a specified location failed. \n***"
316+
echo -e "\n***\n*** Specified mount folder $TRITON_AWS_MOUNT_DIRECTORY is empty \n***"
317+
ls -A $TRITON_AWS_MOUNT_DIRECTORY
318+
exit 1
319+
fi
320+
321+
kill $SERVER_PID
322+
wait $SERVER_PID
323+
324+
if [ -d "$TRITON_AWS_MOUNT_DIRECTORY" ] && [ ! -z "$(ls -A $TRITON_AWS_MOUNT_DIRECTORY)" ]; then
325+
echo -e "\n***\n*** Test localization to a specified location failed. \n***"
326+
echo -e "\n***\n*** Specified mount folder $TRITON_AWS_MOUNT_DIRECTORY was not cleared properly. \n***"
327+
ls -A $TRITON_AWS_MOUNT_DIRECTORY
328+
exit 1
329+
fi
330+
331+
rm -rf $TRITON_AWS_MOUNT_DIRECTORY
332+
unset TRITON_AWS_MOUNT_DIRECTORY
333+
295334
# Save models for AWS_SESSION_TOKEN test
296335
rm -rf tmp_cred_test_models
297336
mv models tmp_cred_test_models
@@ -357,6 +396,7 @@ aws configure set default.region $AWS_DEFAULT_REGION && \
357396
# Copy models into S3 bucket
358397
aws s3 cp tmp_cred_test_models/ "${BUCKET_URL_SLASH}" --recursive --include "*"
359398

399+
SERVER_LOG=$SERVER_LOG_BASE.temporary_credentials_test.log
360400
SERVER_ARGS="--model-repository=$BUCKET_URL --exit-timeout-secs=120"
361401

362402
run_server
@@ -389,6 +429,7 @@ wait $SERVER_PID
389429

390430
# Test access decline
391431
export AWS_SECRET_ACCESS_KEY="[Invalid]" && export AWS_SESSION_TOKEN=""
432+
SERVER_LOG=$SERVER_LOG_BASE.access_decline_test.log
392433
SERVER_ARGS="--model-repository=$BUCKET_URL --exit-timeout-secs=120"
393434
run_server
394435
if [ "$SERVER_PID" != "0" ]; then

qa/L0_storage_azure/test.sh

+39
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,45 @@ for ENV_VAR in "shared_key"; do
169169
wait $SERVER_PID
170170
done
171171

172+
# Test localization to a specified location
173+
export TRITON_AZURE_MOUNT_DIRECTORY=`pwd`/azure_localization_test
174+
175+
if [ -d "$TRITON_AZURE_MOUNT_DIRECTORY" ]; then
176+
rm -rf $TRITON_AZURE_MOUNT_DIRECTORY
177+
fi
178+
179+
mkdir -p $TRITON_AZURE_MOUNT_DIRECTORY
180+
181+
SERVER_LOG=$SERVER_LOG_BASE.custom_localization.log
182+
SERVER_ARGS="--model-repository=$MODEL_REPO --exit-timeout-secs=120"
183+
184+
run_server
185+
if [ "$SERVER_PID" == "0" ]; then
186+
echo -e "\n***\n*** Failed to start $SERVER\n***"
187+
cat $SERVER_LOG
188+
exit 1
189+
fi
190+
191+
if [ -z "$(ls -A $TRITON_AZURE_MOUNT_DIRECTORY)" ]; then
192+
echo -e "\n***\n*** Test localization to a specified location failed. \n***"
193+
echo -e "\n***\n*** Specified mount folder $TRITON_AZURE_MOUNT_DIRECTORY is empty \n***"
194+
ls -A $TRITON_AZURE_MOUNT_DIRECTORY
195+
exit 1
196+
fi
197+
198+
kill $SERVER_PID
199+
wait $SERVER_PID
200+
201+
if [ -d "$TRITON_AZURE_MOUNT_DIRECTORY" ] && [ ! -z "$(ls -A $TRITON_AZURE_MOUNT_DIRECTORY)" ]; then
202+
echo -e "\n***\n*** Test localization to a specified location failed. \n***"
203+
echo -e "\n***\n*** Specified mount folder $TRITON_AZURE_MOUNT_DIRECTORY was not cleared properly. \n***"
204+
ls -A $TRITON_AZURE_MOUNT_DIRECTORY
205+
exit 1
206+
fi
207+
208+
rm -rf $TRITON_AZURE_MOUNT_DIRECTORY
209+
unset TRITON_AZURE_MOUNT_DIRECTORY
210+
172211
# Add test for explicit model control
173212
SERVER_LOG=$SERVER_LOG_BASE.explicit.log
174213
CLIENT_LOG=$CLIENT_LOG_BASE.explicit.log

0 commit comments

Comments
 (0)