Skip to content

Commit

Permalink
Merge pull request galaxyproject#195 from natefoo/fix_galaxy_lib_dir
Browse files Browse the repository at this point in the history
[STABLE] Ensure JobWrapper.galaxy_lib_dir is set
  • Loading branch information
natefoo committed May 1, 2015
2 parents f472d9b + f7e4338 commit 4c7c295
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions lib/galaxy/jobs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def __init__( self, job, queue, use_persisted_destination=False ):
# Tool versioning variables
self.write_version_cmd = None
self.version_string = ""
self.galaxy_lib_dir = None
self.__galaxy_lib_dir = None
# With job outputs in the working directory, we need the working
# directory to be set before prepare is run, or else premature deletion
# and job recovery fail.
Expand Down Expand Up @@ -769,6 +769,12 @@ def get_parallelism(self):
def commands_in_new_shell(self):
return self.app.config.commands_in_new_shell

@property
def galaxy_lib_dir(self):
if self.__galaxy_lib_dir is None:
self.__galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root
return self.__galaxy_lib_dir

# legacy naming
get_job_runner = get_job_runner_url

Expand Down Expand Up @@ -830,8 +836,8 @@ def get_special( ):
self.sa_session.flush()

self.command_line, self.extra_filenames = tool_evaluator.build()
# FIXME: for now, tools get Galaxy's lib dir in their path
self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root
# Ensure galaxy_lib_dir is set in case there are any later chdirs
self.galaxy_lib_dir
# Shell fragment to inject dependencies
self.dependency_shell_commands = self.tool.build_dependency_shell_commands()
# We need command_line persisted to the db in order for Galaxy to re-queue the job
Expand Down Expand Up @@ -1631,9 +1637,8 @@ def prepare( self, compute_environment=None ):

self.command_line, self.extra_filenames = tool_evaluator.build()

# FIXME: for now, tools get Galaxy's lib dir in their path
if self.command_line and self.command_line.startswith( 'python' ):
self.galaxy_lib_dir = os.path.abspath( "lib" ) # cwd = galaxy root
# Ensure galaxy_lib_dir is set in case there are any later chdirs
self.galaxy_lib_dir
# Shell fragment to inject dependencies
self.dependency_shell_commands = self.tool.build_dependency_shell_commands()
# We need command_line persisted to the db in order for Galaxy to re-queue the job
Expand Down

0 comments on commit 4c7c295

Please sign in to comment.