Skip to content

Commit de76cc0

Browse files
committed
INTPYTHON-416 Make AI/ML testing framework runnable locally
1 parent 05e74d4 commit de76cc0

File tree

10 files changed

+41
-41
lines changed

10 files changed

+41
-41
lines changed

.evergreen/utils.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ setup_local_atlas() {
6868
IMAGE=artifactory.corp.mongodb.com/dockerhub/mongodb/mongodb-atlas-local:latest
6969
retry podman pull $IMAGE
7070

71-
CONTAINER_ID=$(podman run --rm -d -e DO_NOT_TRACK=1 -P --health-cmd "/usr/local/bin/runner healthcheck" mongodb/mongodb-atlas-local:latest)
71+
CONTAINER_ID=$(podman run --rm -d -e DO_NOT_TRACK=1 -P --health-cmd "/usr/local/bin/runner healthcheck" $IMAGE)
7272

7373
echo "waiting for container to become healthy..."
7474
function wait() {
@@ -104,13 +104,13 @@ setup_local_atlas() {
104104
wait "$CONTAINER_ID"
105105
EXPOSED_PORT=$(podman inspect --format='{{ (index (index .NetworkSettings.Ports "27017/tcp") 0).HostPort }}' "$CONTAINER_ID")
106106
export CONN_STRING="mongodb://127.0.0.1:$EXPOSED_PORT/?directConnection=true"
107-
# shellcheck disable=SC2154
108-
echo "CONN_STRING=mongodb://127.0.0.1:$EXPOSED_PORT/?directConnection=true" > $workdir/src/.evergreen/.local_atlas_uri
107+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
108+
echo "CONN_STRING=mongodb://127.0.0.1:$EXPOSED_PORT/?directConnection=true" > $SCRIPT_DIR/.local_atlas_uri
109109
}
110110

111111
fetch_local_atlas_uri() {
112-
# shellcheck disable=SC2154
113-
. $workdir/src/.evergreen/.local_atlas_uri
112+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
113+
. $SCRIPT_DIR/.local_atlas_uri
114114

115115
export CONN_STRING=$CONN_STRING
116116
echo "$CONN_STRING"
@@ -120,8 +120,7 @@ fetch_local_atlas_uri() {
120120
scaffold_atlas() {
121121
PYTHON_BINARY=$(find_python3)
122122

123-
# Should be called from src
124-
EVERGREEN_PATH=$(pwd)/.evergreen
123+
EVERGREEN_PATH=$(realpath $(dirname ${BASH_SOURCE[0]}))
125124
TARGET_DIR=$(pwd)/$DIR
126125
SCAFFOLD_SCRIPT=$EVERGREEN_PATH/scaffold_atlas.py
127126

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The general layout of this repo looks like this:
5454
Each test subdirectory will automatically have its own local Atlas deployment. As a result, database and collection names will not conflict between different AI/ML integrations. To connect to your local Atlas using a connection string, `utils.sh` has a `fetch_local_atlas_uri` that you can call from the `run.sh` script within your subdirectory. For example:
5555

5656
```bash
57-
. $workdir/src/.evergreen/utils.sh
57+
. .evergreen/utils.sh
5858

5959
CONN_STRING=$(fetch_local_atlas_uri)
6060
```

chatgpt-retrieval-plugin/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
set -eu
66

77
# Get the MONGODB_URI and OPENAI_API_KEY.
8-
# shellcheck disable=SC2154
9-
. $workdir/src/env.sh
8+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
9+
ROOT_DIR=$(dirname $SCRIPT_DIR)
10+
. $ROOT_DIR/env.sh
1011

11-
# shellcheck disable=SC2154
12-
. $workdir/src/.evergreen/utils.sh
12+
. $SCRIPT_DIR/utils.sh
1313

1414
PYTHON_BINARY=$(find_python3)
1515
$PYTHON_BINARY -c "import sys; print(f'Python version found: {sys.version_info}')"

docarray/run.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
set -eu
77

88
# Get the MONGODB_URI.
9-
# shellcheck disable=SC2154
10-
. $workdir/src/env.sh
9+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
10+
ROOT_DIR=$(dirname $SCRIPT_DIR)
1111

12-
# shellcheck disable=SC2154
13-
. $workdir/src/.evergreen/utils.sh
12+
. $ROOT_DIR/env.sh
13+
14+
. $SCRIPT_DIR/utils.sh
1415
PYTHON_BINARY=$(find_python3)
1516
$PYTHON_BINARY -c "import sys; print(f'Python version found: {sys.version_info}')"
1617

langchain-python/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
set -eu
55

66
# Get the MONGODB_URI and OPENAI_API_KEY.
7-
# shellcheck disable=SC2154
8-
. $workdir/src/env.sh
7+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
8+
ROOT_DIR=$(dirname $SCRIPT_DIR)
9+
. $ROOT_DIR/env.sh
910

10-
# shellcheck disable=SC2154
11-
. $workdir/src/.evergreen/utils.sh
11+
. $SCRIPT_DIR/utils.sh
1212

1313
PYTHON_BINARY=$(find_python3)
1414

langgraph-python/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
set -eu
55

66
# Get the MONGODB_URI and OPENAI_API_KEY.
7-
# shellcheck disable=SC2154
8-
. $workdir/src/env.sh
7+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
8+
ROOT_DIR=$(dirname $SCRIPT_DIR)
9+
. $ROOT_DIR/env.sh
910

10-
# shellcheck disable=SC2154
11-
. $workdir/src/.evergreen/utils.sh
11+
. $SCRIPT_DIR/utils.sh
1212

1313
PYTHON_BINARY=$(find_python3)
1414

llama-index-python-kvstore/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
set -eu
44

55
# Get the MONGODB_URI and OPENAI_API_KEY.
6-
# shellcheck disable=SC2154
7-
. $workdir/src/env.sh
6+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
. $ROOT_DIR/env.sh
89

9-
# shellcheck disable=SC2154
10-
. $workdir/src/.evergreen/utils.sh
10+
. $SCRIPT_DIR/utils.sh
1111

1212
PYTHON_BINARY=$(find_python3)
1313
$PYTHON_BINARY -c "import sys; print(f'Python version found: {sys.version_info}')"

llama-index-python-vectorstore/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
set -eu
44

55
# Get the MONGODB_URI and OPENAI_API_KEY.
6-
# shellcheck disable=SC2154
7-
. $workdir/src/env.sh
6+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
. $ROOT_DIR/env.sh
89

9-
# shellcheck disable=SC2154
10-
. $workdir/src/.evergreen/utils.sh
10+
. $SCRIPT_DIR/utils.sh
1111

1212
PYTHON_BINARY=$(find_python3)
1313
$PYTHON_BINARY -c "import sys; print(f'Python version found: {sys.version_info}')"

semantic-kernel-csharp/run.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
set -eu
44

55
# Get the MONGODB_URI.
6-
# shellcheck disable=SC2154
7-
. $workdir/src/env.sh
6+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
. $ROOT_DIR/env.sh
89

9-
# shellcheck disable=SC2154
10-
. $workdir/src/.evergreen/utils.sh
11-
# WORKING_DIR = src/semantic-kernel-csharp/semantic-kernel
10+
. $SCRIPT_DIR/utils.sh
11+
# WORKING_DIR = $ROOT_DIR/semantic-kernel-csharp/semantic-kernel
1212

1313
# Install .NET
1414
DOTNET_SDK_PATH=./.dotnet

semantic-kernel-python/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
set -eu
44

55
# Get the MONGODB_URI and OPENAI_API_KEY.
6-
# shellcheck disable=SC2154
7-
. $workdir/src/env.sh
6+
SCRIPT_DIR=$(realpath $(dirname ${BASH_SOURCE[0]}))
7+
ROOT_DIR=$(dirname $SCRIPT_DIR)
8+
. $ROOT_DIR/env.sh
89

9-
# shellcheck disable=SC2154
10-
. $workdir/src/.evergreen/utils.sh
10+
. $SCRIPT_DIR/utils.sh
1111

1212
PYTHON_BINARY=$(find_python3)
1313

0 commit comments

Comments
 (0)