When using the K8sRunLauncher with Dagster, the code location pod may need to connect to the database configured in the Dagster instance for several reasons. According to the documentation, the Dagster daemon, which is responsible for managing schedules and sensors, periodically checks the runs table in the PostgreSQL database for runs that are ready to be launched. It also submits runs from schedules and sensors.
The daemon launches runs via the K8sRunLauncher, which creates a run worker job with the image specified in the user code deployment. This run worker is responsible for executing the launched Dagster runs. During the run, events that occur are written to the database and then displayed in the UI.
Therefore, when a schedule is triggered, the code location pod needs to connect to the database to:
1. Check the runs table to determine if there are any runs that need to be launched.
2. Write events to the database as the run progresses, which includes materializations, expectations, and any other structured events that occur during the execution of the run.
This connection to the database is essential for the proper functioning of the Dagster instance, as it allows for the coordination between the different components of the system, such as the webserver, the daemon, and the run workers. It ensures that the state of the runs is consistently tracked and that the UI can display the latest information about the runs.
The documentation also mentions that the webserver communicates with user code deployments via gRPC to fetch information needed to populate the Dagster UI, and it frequently checks whether the user code deployment has been updated to fetch new information. This is another reason why the code location pod may need to connect to the database, as part of the overall system's operation to maintain up-to-date information about the state of the runs and the code deployments. Dagster k8s job run fails sql connection... button psycopg in a code location causes a conf... button Deploying with Helm | Dagster button Dagster Docs button Thank you for your feedback!