Skip to content

Commit

Permalink
fix yaml path and add a gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus committed Feb 3, 2025
1 parent 0cb2984 commit d07c340
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 23 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/build_prod_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test Prod Build

on:
workflow_dispatch: # Allows manual triggering of the workflow
push:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test-build-prod:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v4

- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Launch Docker Compose
run: python3 main.py prod --detach
16 changes: 2 additions & 14 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
- name: Set up Docker
uses: docker/setup-buildx-action@v2

- name: Launch Docker Stack
- name: Launch Docker Compose
run: python3 main.py dev --detach
shell: bash

Expand All @@ -39,19 +39,7 @@ runs:
exit 1
fi
- name: Wait for MinIO
shell: bash
run: |
for i in {1..10}; do
if curl --max-time 10 -fs http://127.0.0.1:9001/minio/health/live; then
echo "MinIO is up!"
exit 0
fi
echo "Waiting for MinIO to be ready... Attempt $i"
sleep 10
done
echo "Failed to connect to MinIO after 10 attempts."
exit 1
- name: Run tests that don't require secrets
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ def run_subprocess(command: str, returnStdoutAsValue: bool = False, wait: bool =
stdout=subprocess.PIPE if returnStdoutAsValue else sys.stdout,
stderr=sys.stderr,
)
stdout, _ = process.communicate()
stdout, stderr = process.communicate()
if process.returncode != 0:
print(stderr.decode("utf-8"))
sys.exit(process.returncode)
return stdout.decode("utf-8") if returnStdoutAsValue else None

Expand Down
9 changes: 6 additions & 3 deletions userCode/lib/env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path

from dagster import get_dagster_logger

Expand Down Expand Up @@ -96,7 +97,9 @@ def strict_env(key: str):
LAKEFS_ACCESS_KEY_ID = strict_env("LAKEFS_ACCESS_KEY_ID")
LAKEFS_SECRET_ACCESS_KEY = strict_env("LAKEFS_SECRET_ACCESS_KEY")

DAGSTER_YAML_CONFIG = os.path.join(
os.path.dirname(__file__), "..", "..", "dagster.yaml"
)
_DAGSTER_HOME = Path(
os.environ.get("DAGSTER_HOME", Path(__file__) / "../../..")
).resolve()
DAGSTER_YAML_CONFIG = _DAGSTER_HOME / "dagster.yaml"

assert os.path.exists(DAGSTER_YAML_CONFIG), "the dagster.yaml file does not exist"
3 changes: 2 additions & 1 deletion userCode/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
sources_partitions_def,
)
from .classes import S3
from .types import cli_modes
from .env import (
GLEANERIO_DATAGRAPH_ENDPOINT,
GLEANERIO_PROVGRAPH_ENDPOINT,
Expand Down Expand Up @@ -51,7 +52,7 @@ def run_scheduler_docker_image(
source: str, # which organization we are crawling
image_name: str, # the name of the docker image to pull and validate
args: list[str], # the list of arguments to pass to the gleaner/nabu command
action_name: str, # the name of the action to run inside gleaner/nabu
action_name: cli_modes, # the name of the action to run inside gleaner/nabu
volumeMapping: Optional[list[str]] = None,
):
"""Run a docker image inside the dagster docker runtime"""
Expand Down
8 changes: 4 additions & 4 deletions userCode/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def gleaner_config(context: AssetExecutionContext):
sources = []
names: set[str] = set()

assert (
len(Lines) > 0
), f"No sitemaps found in sitemap index {REMOTE_GLEANER_SITEMAP}"
assert len(Lines) > 0, (
f"No sitemaps found in sitemap index {REMOTE_GLEANER_SITEMAP}"
)

for line in Lines:
basename = REMOTE_GLEANER_SITEMAP.removesuffix(".xml")
Expand Down Expand Up @@ -459,7 +459,7 @@ def nabu_prov_object(context):
GLEANERIO_PROVGRAPH_ENDPOINT,
]
run_scheduler_docker_image(
source,
"source",
NABU_IMAGE,
ARGS,
"prov-object",
Expand Down

0 comments on commit d07c340

Please sign in to comment.