Reload code location not working #24560
-
Hello community 👋 I'd like some insights into what could be wrong with my local Dagster setup. When I try to reload the code location, it doesn't work, even though I can see in the logs that the modules are being loaded again. I have a local docker image running Dagster. Before I was using the @repository decorator, the reload always worked fine. Recently, I migrated the code to use Definitions, and the issue started. Here are some of my files:
FROM base_dagster_image
RUN mkdir -p /opt/dagster/app
WORKDIR /opt/dagster/app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 4000
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-w", "workspace.yaml"]
#CMD ["dagster", "code-server", "start", "-h", "0.0.0.0", "-p", "4000", "-w", "workspace.yaml"] I have tried with code-server and grpc
load_from:
- python_file:
relative_path: "definitions.py"
attribute: "batch"
location_name: "batch"
version: '3.4'
services:
dagster:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
command: >
bash -c "dagster-webserver -h 0.0.0.0 -w /opt/dagster/app/workspace.yaml"
working_dir: /opt/dagster/app/
volumes:
- ./:/opt/dagster/app
environment:
- DAGSTER_HOME=/tmp Based on the logs, I know that my The
from dagster import Definitions, AssetsDefinition, ScheduleDefinition, SensorDefinition, JobDefinition
from dagster._core.definitions.partitioned_schedule import UnresolvedPartitionedAssetScheduleDefinition
from common.utils import recursively_find_instances
dagster_assets = recursively_find_instances(root="batch", types=(AssetsDefinition,))
dagster_schedules = recursively_find_instances(root="batch", types=(ScheduleDefinition,
UnresolvedPartitionedAssetScheduleDefinition))
dagster_sensors = recursively_find_instances(root="batch", types=(SensorDefinition,))
dagster_jobs = recursively_find_instances(root="batch", types=(JobDefinition,))
batch = Definitions(
assets=dagster_assets,
schedules=dagster_schedules,
sensors=dagster_sensors,
jobs=dagster_jobs
# resources={...}
) Update: To provide more context, as I continue debugging what may be the issue. The hot reloading for the container is working. Any insights or recommendations would be really appreciated. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Edit: Fixed the problem with |
Beta Was this translation helpful? Give feedback.
Edit: Fixed the problem with
importlib.reload(module_name)
and it's working perfectly.