Noah Newton
06/08/2023, 6:50 PMdaniel
06/08/2023, 6:53 PMNoah Newton
06/08/2023, 6:55 PMNoah Newton
06/08/2023, 7:01 PMdaniel
06/08/2023, 7:08 PMNoah Newton
06/08/2023, 7:09 PMUserWarning: Error loading repository location dagster_shell:dagster._core.errors.DagsterImportError: Encountered ImportError: `cannot import name 'create_shell_command_op' from partially initialized module 'dagster_shell' (most likely due to a circular import) (/Users/noahnewton/dev/dagster-old/dagster-shell/dagster_shell/__init__.py)` while importing module dagster_shell. Local modules were resolved using the working directory `/Users/noahnewton/dev/dagster-old/dagster-shell`. 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 workspace targets.
Stack Trace:
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_grpc/server.py", line 270, in __init__
self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_grpc/server.py", line 119, in __init__
loadable_targets = get_loadable_targets(
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_grpc/utils.py", line 47, in get_loadable_targets
else loadable_targets_from_python_module(module_name, working_directory)
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_core/workspace/autodiscovery.py", line 35, in loadable_targets_from_python_module
module = load_python_module(
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 140, in load_python_module
raise DagsterImportError(
The above exception was caused by the following exception:
ImportError: cannot import name 'create_shell_command_op' from partially initialized module 'dagster_shell' (most likely due to a circular import) (/Users/noahnewton/dev/dagster-old/dagster-shell/dagster_shell/__init__.py)
Stack Trace:
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/site-packages/dagster/_core/code_pointer.py", line 135, in load_python_module
return importlib.import_module(module_name)
File "/Users/noahnewton/mambaforge/envs/dag3.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/noahnewton/dev/dagster-old/dagster-shell/dagster_shell/__init__.py", line 3, in <module>
from . import assets
File "/Users/noahnewton/dev/dagster-old/dagster-shell/dagster_shell/assets.py", line 2, in <module>
from dagster_shell import create_shell_command_op, create_shell_script_op, execute_shell_command, execute_shell_script
warnings.warn(
daniel
06/08/2023, 7:10 PMNoah Newton
06/08/2023, 7:11 PMfrom dagster import graph, file_relative_path, OpExecutionContext, op
from dagster_shell import create_shell_command_op, create_shell_script_op, execute_shell_command, execute_shell_script
@graph
def my_graph():
a = create_shell_command_op('echo "hello world"', name="a")
a()
@graph
def my_graph2():
a = create_shell_script_op(file_relative_path(__file__, "hello_world.sh"), name="a")
a()
@op
def my_shell_op(context: OpExecutionContext, data: str):
temp_file = "/tmp/data.txt"
with open(temp_file, "w", encoding="utf-8") as temp_file_writer:
temp_file_writer.write(data)
execute_shell_command(f"cat {temp_file}", output_logging="STREAM", log=context.log)
@op
def my_shell_op2(context: OpExecutionContext, data: str):
temp_file = "/tmp/echo_data.sh"
with open(temp_file, "w", encoding="utf-8") as temp_file_writer:
temp_file_writer.write(f"echo {data}")
execute_shell_script(temp_file, output_logging="STREAM", log=context.log)
daniel
06/08/2023, 7:13 PMdaniel
06/08/2023, 7:13 PMFile "/Users/noahnewton/dev/dagster-old/dagster-shell/dagster_shell/__init__.py", line 3, in <module>
from . import assets
Are you sure that's not something that you somehow created in your code?Noah Newton
06/08/2023, 7:17 PMfrom dagster import Definitions, load_assets_from_modules
from . import assets
all_assets = load_assets_from_modules([assets])
defs = Definitions(
assets=all_assets,
)
daniel
06/08/2023, 7:17 PMNoah Newton
06/08/2023, 7:17 PMdaniel
06/08/2023, 7:18 PMdaniel
06/08/2023, 7:18 PMNoah Newton
06/08/2023, 7:21 PMdaniel
06/08/2023, 7:22 PMNoah Newton
06/08/2023, 7:22 PMdaniel
06/08/2023, 7:22 PMNoah Newton
06/08/2023, 7:22 PMNoah Newton
06/08/2023, 7:28 PM