https://dagster.io/ logo
#dagster-cloud
Title
# dagster-cloud
c

Charles Couble

02/27/2023, 1:27 PM
Hi ! I'm currently facing some strange issues between my local environment & dagster cloud environment. My work is not working in local , but seems to work on dagster cloud (prod). Trying to fix this at the moment, this brings me some questions in my mind : Is there any way to access the dagster cloud instance , even if read only (maybe with enterprise partnership ?) through SSH or something .. Other question, do you provide any docker image or ways to replicate locally the same environment than in dagster serverless ?
d

daniel

02/27/2023, 1:43 PM
Hey Charles, can you share more about the error that you’re seeing? The advice we give here might depend a bit on that
c

Charles Couble

02/27/2023, 1:48 PM
Hey Daniel, Thanks for your answer, Here is the error I receive :
Copy code
/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_core/workspace/context.py:602: UserWarning: Error loading repository location dagster_project:AttributeError: 'AuthByDefault' object has no attribute 'timeout'

Stack Trace:
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_grpc/server.py", line 267, in __init__
    self._loaded_repositories: Optional[LoadedRepositories] = LoadedRepositories(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_grpc/server.py", line 116, in __init__
    loadable_targets = get_loadable_targets(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_grpc/utils.py", line 47, in get_loadable_targets
    else loadable_targets_from_python_module(module_name, working_directory)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_core/workspace/autodiscovery.py", line 36, in loadable_targets_from_python_module
    module = load_python_module(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/dagster/_core/code_pointer.py", line 138, in load_python_module
    return importlib.import_module(module_name)
  File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/ccouble/Workspace/dagster_test_february/dagster_project/__init__.py", line 6, in <module>
    from .__jobs__ import *
  File "/home/ccouble/Workspace/dagster_test_february/dagster_project/__jobs__.py", line 2, in <module>
    from dagster_project.jobs.mapp_most_recent_article import compute_mapp_most_recent_article
  File "/home/ccouble/Workspace/dagster_test_february/dagster_project/jobs/mapp_most_recent_article.py", line 16, in <module>
    snowflake = SnowflakeOperator(password='PASSWORD' , user='USER', database=DATABASE, schema=SCHEMA)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/internals/SnowflakeOperator.py", line 25, in __init__
    self.connection = self.engine.connect()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3315, in connect
    return self._connection_cls(self, close_with_result=close_with_result)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 96, in __init__
    else engine.raw_connection()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3394, in raw_connection
    return self._wrap_pool_connect(self.pool.connect, _connection)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 3361, in _wrap_pool_connect
    return fn()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 327, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
    rec = pool._do_get()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py", line 146, in _do_get
    self._dec_overflow()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/impl.py", line 143, in _do_get
    return self._create_connection()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
    return _ConnectionRecord(self)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
    self.__connect()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 691, in __connect
    pool.logger.debug("Error on connect(): %s", e)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__
    compat.raise_(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
    raise exception
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/pool/base.py", line 686, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/create.py", line 578, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 598, in connect
    return self.dbapi.connect(*cargs, **cparams)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/__init__.py", line 51, in Connect
    return SnowflakeConnection(**kwargs)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/connection.py", line 292, in __init__
    self.connect(**kwargs)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/connection.py", line 542, in connect
    self.__open_connection()
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/connection.py", line 781, in __open_connection
    self._authenticate(auth_instance)
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/connection.py", line 1044, in _authenticate
    self.__authenticate(self.__preprocess_auth_instance(auth_instance))
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/connection.py", line 1064, in __authenticate
    auth.authenticate(
  File "/home/ccouble/Workspace/dagster_test_february/env/lib/python3.8/site-packages/snowflake/connector/auth/_auth.py", line 246, in authenticate
    auth_timeout = min(self._rest._connection.login_timeout, auth_instance.timeout)

  warnings.warn(
I believe this error is not related to dagster but the python package management itself. I suspect python package versions / python version or sub dependencies to differ between my local environment and prod environment. This is why I asked the questions :
Way to replicated prod environment / Way to access Dagster Cloud serverless instance
d

daniel

02/27/2023, 4:17 PM
I see - there isn't yet but I think this would be a great feature - perhaps a CLI command that pulls your serverless image and spins it up in
dagster dev
locally? That would help with python package questions like this one. One thing i'm a little unsure about though is why your code is connecting to Snowflake just to load the job definitions, is that expected?
That might indicate some code with side effects in the import path that would be better suited to the body of an op or resource - needing to connect to snowflake just to load your code would be a bit unusual. Back to the original question - I could DM you as a one-off to help understand what packages are installed in your serverless image, and I can file an issue for that feature request to give you more visibility into which packages are installed in your serverless image
c

Charles Couble

02/27/2023, 9:30 PM
Hey Daniel, After searching thoroughly, i found out the problem was linked to the snowflake-connector-python package version 3 which seems to have induced breaking changes compared to 2.9 🤨 (i'm not sure why it was fetching for 3 it in my local machine but 2.9 dagster serverless tho .. ) I will fix this issue by pinning the requirement !
One thing i'm a little unsure about though is why your code is connecting to Snowflake just to load the job definitions, is that expected?
Totally good point ! I've migrated my script to dagster, and left connection initialisation outside of an OP (in global variables basically) I've corrected it thanks for your suggestion Daniel 🙂
35 Views