Zach
06/20/2023, 6:32 PMbuild_op_context
are failing with the following error:
alembic.util.exc.CommandError: Path doesn't exist: '/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/alembic'. Please use the 'init' command to create a new scripts folder.
feels like alembic shouldn't need to run anything when we're using build_op_context
, but maybe I'm missing something? Including the whole stack trace and code in 🧵Zach
06/20/2023, 6:32 PM/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/execution/context/invocation.py:712: in build_op_context
return UnboundOpExecutionContext(
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/execution/context/invocation.py:94: in __init__
self._instance = self._instance_cm.__enter__()
/Users/zach/.pyenv/versions/3.9.5/lib/python3.9/contextlib.py:117: in __enter__
return next(self.gen)
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/execution/api.py:279: in ephemeral_instance_if_missing
with DagsterInstance.ephemeral() as ephemeral_instance:
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/instance/__init__.py:470: in ephemeral
run_storage=InMemoryRunStorage(preload=preload),
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/runs/in_memory.py:35: in __init__
stamp_alembic_rev(alembic_config, self._held_conn)
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/sql.py:68: in stamp_alembic_rev
stamp(alembic_config, rev)
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/alembic/command.py:644: in stamp
script = ScriptDirectory.from_config(config)
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/alembic/script/base.py:221: in from_config
return ScriptDirectory(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <alembic.script.base.ScriptDirectory object at 0x2a5e09490>, dir = PosixPath('/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/alembic'), file_template = '%(rev)s_%(slug)s', truncate_slug_length = None, version_locations = None, sourceless = False, output_encoding = 'utf-8'
timezone = None, hook_config = {'black.entrypoint': 'black', 'black.options': '--line-length 100 --target-version py36 --target-version py37 --target...s/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/runs/sqlite/alembic', ...}, recursive_version_locations = False
messaging_opts = immutabledict({'quiet': False})
def __init__(
self,
dir: str, # noqa
file_template: str = _default_file_template,
truncate_slug_length: Optional[int] = 40,
version_locations: Optional[List[str]] = None,
sourceless: bool = False,
output_encoding: str = "utf-8",
timezone: Optional[str] = None,
hook_config: Optional[Mapping[str, str]] = None,
recursive_version_locations: bool = False,
messaging_opts: MessagingOptions = cast(
"MessagingOptions", util.EMPTY_DICT
),
) -> None:
self.dir = dir
self.file_template = file_template
self.version_locations = version_locations
self.truncate_slug_length = truncate_slug_length or 40
self.sourceless = sourceless
self.output_encoding = output_encoding
self.revision_map = revision.RevisionMap(self._load_revisions)
self.timezone = timezone
self.hook_config = hook_config
self.recursive_version_locations = recursive_version_locations
self.messaging_opts = messaging_opts
if not os.access(dir, os.F_OK):
> raise util.CommandError(
"Path doesn't exist: %r. Please use "
"the 'init' command to create a new "
"scripts folder." % os.path.abspath(dir)
)
E alembic.util.exc.CommandError: Path doesn't exist: '/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/dagster/_core/storage/alembic'. Please use the 'init' command to create a new scripts folder.
/Users/zach/Documents/empirico/projects/etxlib/.venvs/dagster3/lib/python3.9/site-packages/alembic/script/base.py:102: CommandError
Zach
06/20/2023, 6:32 PMop_context = build_op_context(
resources={"s3": mock_s3, "file_manager": mock_file_manager},
op_config=test_run_config,
)
Zach
06/20/2023, 6:33 PMpyfakefs
, maybe that's causing an issue?Zach
06/20/2023, 8:03 PMpyfakefs
. Will need to use the tmp_path
fixture instead.