Hi there, I seem to be bumping in to an issue with...
# announcements
d
Hi there, I seem to be bumping in to an issue with the cron-scheduler. I've been getting errors similar to the one below from the
last tick
error modal. I'm able to initiate a one-off execution via the dagit interface, CLI and the execute_pipeline utility, but I seem to be having some path/venv issues when trying to schedule a run. Any direction would be appreciated. Thanks! 😄
Copy code
ModuleNotFoundError: No module named 'src'
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/cli/api.py", line 539, in _schedule_tick_state
    yield holder
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/cli/api.py", line 597, in launch_scheduled_execution
    schedule_def = schedule.get_definition()
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/definitions/reconstructable.py", line 201, in get_definition
    return self.repository.get_definition().get_schedule_def(self.schedule_name)
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/definitions/reconstructable.py", line 34, in get_definition
    return repository_def_from_pointer(self.pointer)
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/definitions/reconstructable.py", line 306, in repository_def_from_pointer
    target = def_from_pointer(pointer)
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/definitions/reconstructable.py", line 269, in def_from_pointer
    target = pointer.load_target()
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/code_pointer.py", line 84, in load_target
    module = load_python_file(self.python_file)
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/core/code_pointer.py", line 73, in load_python_file
    return import_module_from_path(module_name, python_file)
  File "/Users/douglasbinder/workspace/primeshares/jobs/venv/lib/python3.7/site-packages/dagster/seven/__init__.py", line 94, in import_module_from_path
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/douglasbinder/workspace/primeshares/jobs/dag_pipelines.py", line 9, in <module>
    from src.utils.manage_dag_config import config
a
I am guessing
src
is a file or directory that importing only works when the current working directory is the one you usually operate from (which cron is not running from)
cc @prha who is working on better support for this
whats your
workspace.yaml
set up?
d
its pretty basic
Copy code
load_from:
  - python_file: dag_pipelines.py
a
then just to be sure, whats the
src
import edit: oop never mind its in the stacktrace
d
I can drop in a slimmed down dag_pipelines if that would be helpful
a
no the issue is clear,
from src.utils.manage_dag_config import config
only works when you are invoking commands out of that parent directory. When cron wakes up to fire the schedule its not running out of that directory so it fails
p
the current workaround is to install
src
as an installed module and use the
python_module
option:
Copy code
load_from:
  - python_module: src
d
hmm, so I have my project set up like
Copy code
proj_root/
- dag_pipelines.py
- src/...
With that fix, do I need to move dag_pipelines into src?
p
You could also install
proj_root
as a module instead and use relative imports into src?
d
gotcha, will tinker with it. Thanks!
p
Hoping to have a fix for this soon though, which would allow you to add a
working_directory
config argument in your workspace
and then you should just be able to specify:
Copy code
load_from:
  - python_file:
      relative_path: dag_pipelines.py
      working_directory: ./
d
Understood, I just got the module piece working. I had some config files I needed to shuffle around. Appreciate the help!