Skip to content

Commit

Permalink
Use large github action machine to run e2e tests (#230)
Browse files Browse the repository at this point in the history
  • Loading branch information
adilhafeez authored Oct 31, 2024
1 parent bb882fb commit e462e39
Show file tree
Hide file tree
Showing 30 changed files with 4,729 additions and 445 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/e2e_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:

jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-latest-m
# runs-on: gh-large-150gb-ssd

steps:
- name: Checkout code
Expand All @@ -29,4 +30,5 @@ jobs:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }}
run: |
cd e2e_tests && bash run_e2e_tests.sh
python -mvenv venv
source venv/bin/activate && cd e2e_tests && bash run_e2e_tests.sh
2 changes: 1 addition & 1 deletion arch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ FROM envoyproxy/envoy:v1.31-latest as envoy
#Build config generator, so that we have a single build image for both Rust and Python
FROM python:3-slim as arch

RUN apt-get update && apt-get install -y gettext-base && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y gettext-base curl && apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=builder /arch/target/wasm32-wasi/release/prompt_gateway.wasm /etc/envoy/proxy-wasm-plugins/prompt_gateway.wasm
COPY --from=builder /arch/target/wasm32-wasi/release/llm_gateway.wasm /etc/envoy/proxy-wasm-plugins/llm_gateway.wasm
Expand Down
7 changes: 6 additions & 1 deletion arch/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ services:
- /etc/ssl/cert.pem:/etc/ssl/cert.pem
- ~/archgw_logs:/var/log/
env_file:
- stage.env
- env.list
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:10000/healthz"]
interval: 30s
timeout: 10s
retries: 3
File renamed without changes.
3 changes: 1 addition & 2 deletions arch/tools/build_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Define paths
source_schema="../arch_config_schema.yaml"
source_compose="../docker-compose.yaml"
source_stage_env="../stage.env"
destination_dir="config"

# Ensure the destination directory exists only if it doesn't already
Expand All @@ -15,7 +14,7 @@ fi
# Copy the files
cp "$source_schema" "$destination_dir/arch_config_schema.yaml"
cp "$source_compose" "$destination_dir/docker-compose.yaml"
cp "$source_stage_env" "$destination_dir/stage.env"
touch "$destination_dir/env.list"

# Print success message
echo "Files copied successfully!"
Expand Down
3 changes: 1 addition & 2 deletions arch/tools/cli/config_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def validate_and_render_schema():
try:
validate_prompt_config(ARCH_CONFIG_FILE, ARCH_CONFIG_SCHEMA_FILE)
except Exception as e:
print(e)
print(str(e))
exit(1) # validate_prompt_config failed. Exit

with open(ARCH_CONFIG_FILE, "r") as file:
Expand Down Expand Up @@ -73,7 +73,6 @@ def validate_and_render_schema():

print("updated clusters", inferred_clusters)

config_yaml = add_secret_key_to_llm_providers(config_yaml)
arch_llm_providers = config_yaml["llm_providers"]
arch_tracing = config_yaml.get("tracing", {})
arch_config_string = yaml.dump(config_yaml)
Expand Down
15 changes: 12 additions & 3 deletions arch/tools/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def main(ctx, version):
click.echo(f"archgw cli version: {get_version()}")
ctx.exit()

log.info(f"Starting archgw cli version: {get_version()}")

if ctx.invoked_subcommand is None:
click.echo("""Arch (The Intelligent Prompt Gateway) CLI""")
click.echo(logo)
Expand All @@ -68,7 +70,7 @@ def main(ctx, version):
@click.option(
"--service",
default=SERVICE_ALL,
help="Optioanl parameter to specify which service to build. Options are model_server, archgw",
help="Optional parameter to specify which service to build. Options are model_server, archgw",
)
def build(service):
"""Build Arch from source. Must be in root of cloned repo."""
Expand Down Expand Up @@ -168,7 +170,7 @@ def up(file, path, service):
arch_config_schema_file=arch_schema_config,
)
except Exception as e:
log.info(f"Exiting archgw up: {e}")
log.info(f"Exiting archgw up: validation failed")
sys.exit(1)

log.info("Starging arch model server and arch gateway")
Expand All @@ -178,6 +180,12 @@ def up(file, path, service):
env = os.environ.copy()
# check if access_keys are preesnt in the config file
access_keys = get_llm_provider_access_keys(arch_config_file=arch_config_file)

# remove duplicates
access_keys = set(access_keys)
# remove the $ from the access_keys
access_keys = [item[1:] if item.startswith("$") else item for item in access_keys]

if access_keys:
if file:
app_env_file = os.path.join(
Expand All @@ -186,6 +194,7 @@ def up(file, path, service):
else:
app_env_file = os.path.abspath(os.path.join(path, ".env"))

print(f"app_env_file: {app_env_file}")
if not os.path.exists(
app_env_file
): # check to see if the environment variables in the current environment or not
Expand All @@ -205,7 +214,7 @@ def up(file, path, service):
env_stage[access_key] = env_file_dict[access_key]

with open(
pkg_resources.resource_filename(__name__, "../config/stage.env"), "w"
pkg_resources.resource_filename(__name__, "../config/env.list"), "w"
) as file:
for key, value in env_stage.items():
file.write(f"{key}={value}\n")
Expand Down
Loading

0 comments on commit e462e39

Please sign in to comment.