generated from MileTwo/dagster-example-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gaëtan DUHAMEL
committed
Jun 21, 2023
1 parent
1ba362b
commit f40a5a6
Showing
10 changed files
with
252 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Dagster libraries to run both dagit and the dagster-daemon. Does not | ||
# need to have access to any pipeline code. | ||
|
||
FROM python:3.7-slim | ||
|
||
RUN pip install \ | ||
dagster \ | ||
dagster-graphql \ | ||
dagit \ | ||
dagster-postgres \ | ||
dagster-docker | ||
|
||
# Set $DAGSTER_HOME and copy dagster instance and workspace YAML there | ||
ENV DAGSTER_HOME=/opt/dagster/dagster_home/ | ||
|
||
RUN mkdir -p $DAGSTER_HOME | ||
|
||
COPY dagster.yaml workspace.yaml $DAGSTER_HOME | ||
|
||
WORKDIR $DAGSTER_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM python:3.7-slim | ||
|
||
# Checkout and install dagster libraries needed to run the gRPC server | ||
# exposing your repository to dagit and dagster-daemon, and to load the DagsterInstance | ||
|
||
RUN pip install \ | ||
dagster \ | ||
dagster-postgres \ | ||
dagster-docker | ||
|
||
# Add repository code | ||
|
||
WORKDIR /opt/dagster/app | ||
|
||
COPY repo.py /opt/dagster/app | ||
|
||
# Run dagster gRPC server on port 4000 | ||
|
||
EXPOSE 4000 | ||
|
||
# CMD allows this to be overridden from run launchers or executors that want | ||
# to run other commands against your repository | ||
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-f", "repo.py"] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
scheduler: | ||
module: dagster.core.scheduler | ||
class: DagsterDaemonScheduler | ||
|
||
run_coordinator: | ||
module: dagster.core.run_coordinator | ||
class: QueuedRunCoordinator | ||
|
||
run_launcher: | ||
module: dagster_docker | ||
class: DockerRunLauncher | ||
config: | ||
env_vars: | ||
- DAGSTER_POSTGRES_USER | ||
- DAGSTER_POSTGRES_PASSWORD | ||
- DAGSTER_POSTGRES_DB | ||
network: docker_example_network | ||
container_kwargs: | ||
volumes: # Make docker client accessible to any launched containers as well | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- /tmp/io_manager_storage:/tmp/io_manager_storage | ||
|
||
run_storage: | ||
module: dagster_postgres.run_storage | ||
class: PostgresRunStorage | ||
config: | ||
postgres_db: | ||
hostname: postgres | ||
username: | ||
env: DAGSTER_POSTGRES_USER | ||
password: | ||
env: DAGSTER_POSTGRES_PASSWORD | ||
db_name: | ||
env: DAGSTER_POSTGRES_DB | ||
port: 5432 | ||
|
||
schedule_storage: | ||
module: dagster_postgres.schedule_storage | ||
class: PostgresScheduleStorage | ||
config: | ||
postgres_db: | ||
hostname: postgres | ||
username: | ||
env: DAGSTER_POSTGRES_USER | ||
password: | ||
env: DAGSTER_POSTGRES_PASSWORD | ||
db_name: | ||
env: DAGSTER_POSTGRES_DB | ||
port: 5432 | ||
|
||
event_log_storage: | ||
module: dagster_postgres.event_log | ||
class: PostgresEventLogStorage | ||
config: | ||
postgres_db: | ||
hostname: postgres | ||
username: | ||
env: DAGSTER_POSTGRES_USER | ||
password: | ||
env: DAGSTER_POSTGRES_PASSWORD | ||
db_name: | ||
env: DAGSTER_POSTGRES_DB | ||
port: 5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from dagster import FilesystemIOManager, graph, op, repository, schedule | ||
from dagster_docker import docker_executor | ||
|
||
|
||
@op | ||
def hello(): | ||
return 1 | ||
|
||
|
||
@op | ||
def goodbye(foo): | ||
if foo != 1: | ||
raise Exception("Bad io manager") | ||
return foo * 2 | ||
|
||
|
||
@graph | ||
def my_graph(): | ||
goodbye(hello()) | ||
|
||
|
||
my_job = my_graph.to_job(name="my_job") | ||
|
||
my_step_isolated_job = my_graph.to_job( | ||
name="my_step_isolated_job", | ||
executor_def=docker_executor, | ||
resource_defs={ | ||
"io_manager": FilesystemIOManager(base_dir="/tmp/io_manager_storage") | ||
}, | ||
) | ||
|
||
|
||
@schedule(cron_schedule="* * * * *", job=my_job, execution_timezone="US/Central") | ||
def my_schedule(_context): | ||
return {} | ||
|
||
|
||
@repository | ||
def deploy_docker_repository(): | ||
return [my_job, my_step_isolated_job, my_schedule] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dagster | ||
dagit | ||
dagster-docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[tox] | ||
envlist = py{39,38,37,36}-{unix,windows} | ||
skipsdist = True | ||
|
||
[testenv] | ||
download = True | ||
passenv = CI_* COVERALLS_REPO_TOKEN BUILDKITE* DEPLOY_DOCKER_DAGIT_HOST | ||
deps = | ||
-e ../../python_modules/dagster[test] | ||
allowlist_externals = | ||
/bin/bash | ||
commands = | ||
!windows: /bin/bash -c '! pip list --exclude-editable | grep -e dagster -e dagit' | ||
pytest -c ../../pyproject.toml -vv {posargs} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
load_from: | ||
# Each entry here corresponds to a service in the docker-compose file that exposes user code. | ||
- grpc_server: | ||
host: dagster_multi_user_code | ||
port: 4000 | ||
location_name: "edagster_multi_user_code_1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters