Skip to content

Commit

Permalink
Merge pull request #280 from galaxyproject/drop_metadata_hacks
Browse files Browse the repository at this point in the history
Drop metadata directory hacks for pre-16.04 Galaxies.
  • Loading branch information
jmchilton authored Jul 21, 2021
2 parents 5ea26dd + 40a9c90 commit 7f21ae2
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 29 deletions.
2 changes: 2 additions & 0 deletions pulsar/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ def _setup_params_from_job_config(job_config):
tool_id = job_config.get("tool_id", None)
tool_version = job_config.get("tool_version", None)
preserve_galaxy_python_environment = job_config.get("preserve_galaxy_python_environment", None)
# use_metadata ignored post Pulsar 0.14.12+ but keep setting it for older Pulsar's that
# had hacks for pre-2017 Galaxies.
return dict(
job_id=job_id,
tool_id=tool_id,
Expand Down
6 changes: 1 addition & 5 deletions pulsar/manager_endpoint_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,11 @@ def submit_job(manager, job_config):
input_job_id = setup_params.get("job_id", job_id)
tool_id = setup_params.get("tool_id", None)
tool_version = setup_params.get("tool_version", None)
use_metadata = setup_params.get("use_metadata", False)
job_config = setup_job(
manager,
input_job_id,
tool_id,
tool_version,
use_metadata,
)

if job_config is not None:
Expand All @@ -111,13 +109,11 @@ def submit_job(manager, job_config):
raise


def setup_job(manager, job_id, tool_id, tool_version, use_metadata=False):
def setup_job(manager, job_id, tool_id, tool_version):
""" Setup new job from these inputs and return dict summarizing state
(used to configure command line).
"""
job_id = manager.setup_job(job_id, tool_id, tool_version)
if use_metadata:
manager.enable_metadata_directory(job_id)
return build_job_config(
job_id=job_id,
job_directory=manager.job_directory(job_id),
Expand Down
3 changes: 0 additions & 3 deletions pulsar/managers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ def stderr_contents(self, *args, **kwargs):
def kill(self, *args, **kwargs):
return self._proxied_manager.kill(*args, **kwargs)

def enable_metadata_directory(self, *args, **kwargs):
return self._proxied_manager.enable_metadata_directory(*args, **kwargs)

def shutdown(self, timeout=None):
""" Optional. """
try:
Expand Down
13 changes: 0 additions & 13 deletions pulsar/managers/base/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,6 @@ def __init__(
# Assert this job id isn't hacking path somehow.
assert job_id == basename(job_id)

def enable_metadata_directory(self):
self.store_metadata("use_metadata_directory", True)

@property
def use_metadata_directory(self):
return self.has_metadata("use_metadata_directory")

def _job_file(self, name):
return os.path.join(self.job_directory, name)

Expand Down Expand Up @@ -329,12 +322,6 @@ def job_directory_contents(self):
# Set recursive to False to just get the top-level artifacts
return self.__directory_contents(self.job_directory, recursive=False)

def metadata_directory(self):
if self.use_metadata_directory:
return super(JobDirectory, self).metadata_directory()
else:
return self.working_directory()

def __directory_contents(self, directory, recursive=True):
contents = []
if recursive:
Expand Down
3 changes: 0 additions & 3 deletions pulsar/managers/base/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ def _write_tool_info(self, job_id, tool_id, tool_version):
def _write_command_line(self, job_id, command_line):
self._write_job_file(job_id, JOB_FILE_COMMAND_LINE, command_line)

def enable_metadata_directory(self, job_id):
self._job_directory(job_id).enable_metadata_directory()

def _record_cancel(self, job_id):
try:
self._job_directory(job_id).store_metadata(JOB_FILE_CANCELLED, True)
Expand Down
9 changes: 4 additions & 5 deletions pulsar/web/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ def _app_args(self, args, req):


@PulsarController(path="/jobs", method="POST", response_type='json')
def setup(manager, job_id, tool_id=None, tool_version=None, use_metadata='false'):
return __setup(manager, job_id, tool_id=tool_id, tool_version=tool_version, use_metadata=use_metadata)
def setup(manager, job_id, tool_id=None, tool_version=None, use_metadata='true'):
return __setup(manager, job_id, tool_id=tool_id, tool_version=tool_version)


def __setup(manager, job_id, tool_id, tool_version, use_metadata):
use_metadata = loads(use_metadata)
response = setup_job(manager, job_id, tool_id, tool_version, use_metadata)
def __setup(manager, job_id, tool_id, tool_version):
response = setup_job(manager, job_id, tool_id, tool_version)
log.debug("Setup job with configuration: %s" % response)
return response

Expand Down

0 comments on commit 7f21ae2

Please sign in to comment.