Danny Steffy
03/15/2023, 5:08 PMJean Gonzalez
03/15/2023, 5:17 PMDanny Steffy
03/15/2023, 5:21 PMresources
folder. I just noticed in the Definitions
API information that
Jobs created with @job must already have resources bound at job creation time. They do not respect the resources argument here.
This means that we would need to import the resources in the resources
folder, but I don't see a way to do that in our current folder structure do to not being able to do a relative import above the current module, correct? Is there some other workaround or folder layout we should be using? Defining the resources a second time inside the sensors
module would mean duplicate codeAdam Bloom
03/15/2023, 5:29 PMDanny Steffy
03/15/2023, 5:33 PM/opt/dagster/app/
which is where we copy over our dagster-code structure to.___init___.py
in each folder in our structure. Should we not be doing that?Adam Bloom
03/15/2023, 5:35 PMDanny Steffy
03/15/2023, 5:35 PMAdam Bloom
03/15/2023, 5:38 PMDanny Steffy
03/15/2023, 5:38 PMAdam Bloom
03/15/2023, 5:39 PMdagit -m dagster_user_code
(usually managed by the helm chart, but an example from local development)Danny Steffy
03/15/2023, 5:40 PMENTRYPOINT ["dagit", "-h", "0.0.0.0", "-p", "80", "-w", "workspace.yaml"]
CMD ["dagster", "api", "grpc", "-h", "0.0.0.0", "-p", "4000", "-f", "repo.py", "--working-directory", "/opt/dagster/app/"]
CMD ["dagster-daemon", "run"]
Adam Bloom
03/15/2023, 5:42 PM__init__.py
in dagster_user_code
, which allows us to simply reference that module. That file imports from submodules, so we don't have a single file equivalent. but starting up with a module vs a file may matter, I can't rememberdagster_user_code.sensors.sensor_a
has an import like the following:
from dagster_user_code.jobs.dbt import dbt_test_doc_job_factory
dagster_user_code
needs to be a resolvable module in the interpreter. and since that's how we launch dagster, we know it isDanny Steffy
03/15/2023, 5:47 PM___init__.py_
at the top level of our dagster-code
folder. Do we need to add something in there to make it a resolvable module?Adam Bloom
03/15/2023, 5:48 PMdagster-code
module, instead of at repo.py
, so you might need to modify that file to load the contents of repo.py
Jake Kagan
03/15/2023, 5:50 PMDanny Steffy
03/15/2023, 5:55 PMdagster._core.errors.DagsterImportError: Encountered ImportError: `attempted relative import beyond top-level package` while importing module repo from file /opt/dagster/app/repo.py. Local modules were resolved using the working directory `/opt/dagster/app`. If another working directory should be used, please explicitly specify the appropriate path using the `-d` or `--working-directory` for CLI based targets or the `working_directory` configuration option for `python_file`-based workspace targets.
Adam Bloom
03/15/2023, 6:02 PMjobs.__
Danny Steffy
03/15/2023, 6:02 PMfrom ...resources.sql_resources import SQL_RESOURCES
from resources.sql_resources import SQL_RESOURCES
?Adam Bloom
03/15/2023, 6:04 PMDanny Steffy
03/15/2023, 6:05 PMrepo.py
is where the working directory is, so we can just import modules relative to that?Jake Kagan
03/15/2023, 6:07 PMAdam Bloom
03/15/2023, 6:07 PMJake Kagan
03/15/2023, 6:08 PMAdam Bloom
03/15/2023, 6:12 PM-e
flag to install a module as editable (aka just a fancy symlink)Jake Kagan
03/15/2023, 6:17 PMio_managers
would be treated like a module, you're saying you load dagster with a list of modules? im totally confusedAdam Bloom
03/15/2023, 6:25 PMJake Kagan
03/15/2023, 6:26 PM