Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lexists vs. exists #3301

Merged
merged 1 commit into from Dec 12, 2016

Conversation

Projects
None yet
4 participants
@bgruening
Copy link
Member

commented Dec 11, 2016

I have a wired behavior in Docker, in which the os.path.exists(parent_path) seems to return False but the path exists, it's a symlink. This results in the following error:

Traceback (most recent call last):
  File "lib/galaxy/webapps/galaxy/buildapp.py", line 55, in paste_app_factory
    app = galaxy.app.UniverseApplication( global_conf=global_conf, **kwargs )
  File "lib/galaxy/app.py", line 98, in __init__
    self._configure_toolbox()
  File "lib/galaxy/config.py", line 856, in _configure_toolbox
    self.reload_toolbox()
  File "lib/galaxy/config.py", line 840, in reload_toolbox
    self.toolbox = tools.ToolBox( tool_configs, self.config.tool_path, self )
  File "lib/galaxy/tools/__init__.py", line 116, in __init__
    tool_conf_watcher=tool_conf_watcher
  File "lib/galaxy/tools/toolbox/base.py", line 1068, in __init__
    self._init_dependency_manager()
  File "lib/galaxy/tools/toolbox/base.py", line 1081, in _init_dependency_manager
    self.dependency_manager = build_dependency_manager( self.app.config )
  File "lib/galaxy/tools/deps/__init__.py", line 57, in build_dependency_manager
    dependency_manager = DependencyManager( **dependency_manager_kwds )
  File "lib/galaxy/tools/deps/__init__.py", line 100, in __init__
    self.dependency_resolvers = self.__build_dependency_resolvers( conf_file )
  File "lib/galaxy/tools/deps/__init__.py", line 147, in __build_dependency_resolvers
    return self.__default_dependency_resolvers()
  File "lib/galaxy/tools/deps/__init__.py", line 156, in __default_dependency_resolvers
    CondaDependencyResolver(self),
  File "lib/galaxy/tools/deps/resolvers/conda.py", line 97, in __init__
    self.disabled = not galaxy.tools.deps.installable.ensure_installed(conda_context, install_conda, self.auto_init)
  File "lib/galaxy/tools/deps/installable.py", line 68, in ensure_installed
    os.mkdir(parent_path)
OSError: [Errno 17] File exists: '/export/tool_deps'

According to the docs https://docs.python.org/2/library/os.path.html#os.path.lexists lexists should also return True for a broken symlink, which at least in this case would not crash in the os.mkdir step. I'm a little bit puzzled why this fails at all, because this is a valid symlink, but lexists seems to be more correct here.

We might warn in case of a broken symlink but this is a different question.

@galaxybot galaxybot added the triage label Dec 11, 2016

@galaxybot galaxybot added this to the 17.01 milestone Dec 11, 2016

@bgruening

This comment has been minimized.

Copy link
Member Author

commented Dec 11, 2016

An example where this patch is needed can be seen here: bgruening/docker-galaxy-stable#264

@dannon

This comment has been minimized.

Copy link
Member

commented Dec 12, 2016

+1, yeah, looks correct to me.

@dannon dannon merged commit 8b9337f into galaxyproject:dev Dec 12, 2016

4 checks passed

api test Build finished. 243 tests run, 0 skipped, 0 failed.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
framework test Build finished. 131 tests run, 0 skipped, 0 failed.
Details
toolshed test Build finished. 580 tests run, 0 skipped, 0 failed.
Details

@bgruening bgruening deleted the bgruening:lexists branch Dec 12, 2016

@bgruening

This comment has been minimized.

Copy link
Member Author

commented Dec 12, 2016

Thanks @dannon. Do you think we can get this also in 16.10? Would be important for the Galaxy Docker project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.