Another try...

This commit is contained in:
John Chilton
2021-02-12 11:00:37 -05:00
parent fd92160271
commit b930e60d36
3 changed files with 16 additions and 4 deletions
+4
View File
@@ -2586,6 +2586,10 @@ class SharedComputeEnvironment(SimpleComputeEnvironment):
def working_directory(self):
return self.job_wrapper.working_directory
def env_config_directory(self):
"""Working directory (possibly as environment variable evaluation)."""
return "$_GALAXY_JOB_DIR"
def new_file_path(self):
return os.path.abspath(self.app.config.new_file_path)
+9 -2
View File
@@ -382,11 +382,15 @@ class PulsarJobRunner(AsynchronousJobRunner):
if os.path.exists(tool_script):
log.debug("Registering tool_script for Pulsar transfer [%s]" % tool_script)
job_directory_files.append(tool_script)
# Following is job destination environment variables
env = client.env
# extend it with tool defined environment variables
env.extend(job_wrapper.environment_variables)
tool_envs = job_wrapper.environment_variables
env.extend(tool_envs)
for tool_env in tool_envs:
job_directory_path = tool_env.get("job_directory_path")
if job_directory_path:
config_files.append(job_directory_path)
client_job_description = ClientJobDescription(
command_line=command_line,
@@ -1062,6 +1066,9 @@ class PulsarComputeEnvironment(ComputeEnvironment):
def working_directory(self):
return self._working_directory
def env_config_directory(self):
return self.config_directory()
def config_directory(self):
return self._config_directory
+3 -2
View File
@@ -540,13 +540,14 @@ class ToolEvaluator:
is_template = False
else:
is_template = True
with tempfile.NamedTemporaryFile(dir=directory, delete=False) as temp:
with tempfile.NamedTemporaryFile(dir=directory, prefix="tool_env_", delete=False) as temp:
config_filename = temp.name
self.__write_workdir_file(config_filename, environment_variable_template, param_dict, is_template=is_template, strip=environment_variable_def.get("strip", False))
config_file_basename = os.path.basename(config_filename)
# environment setup in job file template happens before `cd $working_directory`
environment_variable["value"] = '`cat "$_GALAXY_JOB_DIR/%s"`' % config_file_basename
environment_variable["value"] = '`cat "%s/%s"`' % (self.compute_environment.env_config_directory(), config_file_basename)
environment_variable["raw"] = True
environment_variable["job_directory_path"] = config_filename
environment_variables.append(environment_variable)
home_dir = self.compute_environment.home_directory()