Skip to content

Commit

Permalink
Enable K8s Job Executor (#2148)
Browse files Browse the repository at this point in the history
  • Loading branch information
ravenac95 authored Sep 16, 2024
1 parent b741446 commit 25c1ea4
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 56 deletions.
2 changes: 1 addition & 1 deletion ops/helm-charts/oso-dagster/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: oso-dagster
description: Extension of the dagster template

type: application
version: 0.4.3
version: 0.5.0
appVersion: "1.0.0"
dependencies:
- name: dagster
Expand Down
1 change: 1 addition & 0 deletions ops/helm-charts/oso-dagster/templates/config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ data:
DAGSTER_ALERTS_BASE_URL: "{{ .Values.alerts.baseUrl }}"
DAGSTER_HTTP_CACHE: "{{ .Values.cache.uri }}"
DAGSTER_ENABLE_BIGQUERY: "1"
DAGSTER_ENABLE_K8S_EXECUTOR: "1"
DAGSTER_SQLMESH_GATEWAY: clickhouse
SQLMESH_POSTGRES_INSTANCE_CONNECTION_STRING: "{{ .Values.configMap.secretPrefix }}-{{ .Values.secretmanagerKeys.sqlmeshPostgresInstanceStringConnectionString }}"
SQLMESH_POSTGRES_USER: "{{ .Values.configMap.secretPrefix }}-{{ .Values.secretmanagerKeys.sqlmeshPostgresUser }}"
Expand Down
126 changes: 71 additions & 55 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ google-cloud-bigquery-storage = "^2.25.0"
dagster-sqlmesh = "0.2.0.dev3"
google-auth = "^2.34.0"
pillow = "^10.4.0"
dagster-k8s = "^0.24.7"


[tool.poetry.scripts]
Expand Down
2 changes: 2 additions & 0 deletions warehouse/oso_dagster/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ def get_project_id():

sqlmesh_dir = os.getenv("DAGSTER_SQLMESH_DIR", str(repo_dir.joinpath("warehouse/metrics_mesh")))
sqlmesh_gateway = os.getenv("DAGSTER_SQLMESH_GATEWAY", "local")

enable_k8s_executor = os.getenv("DAGSTER_ENABLE_K8S_EXECUTOR", "false").lower() in ["true", "1"]
6 changes: 6 additions & 0 deletions warehouse/oso_dagster/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dagster_dbt import DbtCliResource
from dagster_gcp import BigQueryResource, GCSResource
from dagster_sqlmesh import SQLMeshContextConfig, SQLMeshResource
from dagster_k8s import k8s_job_executor
from dagster_embedded_elt.dlt import DagsterDltResource
from dotenv import load_dotenv
from . import constants
Expand Down Expand Up @@ -116,13 +117,18 @@ def load_definitions():
project_dir=os.fspath(constants.main_dbt_project_dir), target=target
)

extra_kwargs = {}
if constants.enable_k8s_executor:
extra_kwargs["executor"] = k8s_job_executor

return Definitions(
assets=asset_factories.assets,
schedules=all_schedules,
jobs=asset_factories.jobs,
asset_checks=asset_factories.checks,
sensors=asset_factories.sensors,
resources=resources,
**extra_kwargs,
)


Expand Down

0 comments on commit 25c1ea4

Please sign in to comment.