dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
11.66k stars 1.47k forks source link

DockerRunLauncher does not include volume mounts with runtime container instance #4305

Open peters-arrival opened 3 years ago

peters-arrival commented 3 years ago

Summary

Docker Deployed Pipelines executed via Dagit Playground do not respect docker-compose mounted volumes.

When doing local development, it can be desirable to containerize all your dependencies into a docker container and then execute them via a local instance of dagit. ( also deployed via docker )

However, to make this development loop more seamless, one might want to volume mount your repo.py file, such that any updates made to the pipeline are live. Pipeline runs launched via the DockerRunLauncher do not inherit -volume declarations, and therefor, the code sent to the run is stale.

Reproduction

updated from docker_deploy from docker-compose.yml

` ... docker_example_pipelines ... networks:

However, when updating the /path/to/pipeline/repo.py on the host machine, say adding or renaming a solid my_solid --> new_solid_name, dagit, the UI, seems to find the new solid, but when the pipeline is run via the playground, it fails on execution, complaining about the missing solid:

dagster.check.CheckError: Invariant failed. Description: pipe has no solid named new_solid_name. File "/usr/local/lib/python3.8/dist-packages/dagster/grpc/impl.py", line 86, in core_execute_run yield from execute_run_iterator(recon_pipeline, pipeline_run, instance) File "/usr/local/lib/python3.8/dist-packages/dagster/core/execution/api.py", line 836, in __iter__ yield from self.execution_context_manager.prepare_context() File "/usr/local/lib/python3.8/dist-packages/dagster/utils/__init__.py", line 446, in generate_setup_events obj = next(self.generator) File "/usr/local/lib/python3.8/dist-packages/dagster/core/execution/context_creation_pipeline.py", line 350, in orchestration_context_event_generator context_creation_data = create_context_creation_data( File "/usr/local/lib/python3.8/dist-packages/dagster/core/execution/context_creation_pipeline.py", line 157, in create_context_creation_data resource_keys_to_init=get_required_resource_keys_to_init( File "/usr/local/lib/python3.8/dist-packages/dagster/core/execution/resources_init.py", line 325, in get_required_resource_keys_to_init hook_defs = pipeline_def.get_all_hooks_for_handle(step.solid_handle) File "/usr/local/lib/python3.8/dist-packages/dagster/core/definitions/pipeline.py", line 470, in get_all_hooks_for_handle solid = self.solid_named(name) File "/usr/local/lib/python3.8/dist-packages/dagster/core/definitions/graph.py", line 201, in solid_named check.invariant( File "/usr/local/lib/python3.8/dist-packages/dagster/check/__init__.py", line 167, in invariant raise CheckError(f"Invariant failed. Description: {desc}")

One possible work around is:

It would greatly lessen the development loop if the instantiated custom_service container could include the volume mounts during DockerRunLauncher execution

Dagit UI/UX Issue Screenshots

Additional Info about Your Environment


Message from the maintainers:

Impacted by this bug? Give it a 👍. We factor engagement into prioritization.

dangal95 commented 1 year ago

+1. I am having a similar issue. I mount AWS credentials files to my user deployment code so that I don't hardode the access keys anywhere in my code. However, when I launch a job I get a "credentials not found" error when using anything from dagster-aws. I checked the user deployment container and it contains the file, but the containers launched by the DockerRunLauncher do not contain this file even though it is deploying a container with the same image.