Skip to content

Commit

Permalink
Modify @erasche awesome approach to use configured jobs directory...
Browse files Browse the repository at this point in the history
... instead of Pulsar root. This allows Galaxy to assume even less about how Pulsar is reflected.
  • Loading branch information
jmchilton committed Oct 10, 2014
1 parent 2bf5fa8 commit 44d7a5a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions pulsar/client/setup_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def build_job_config(job_id, job_directory, system_properties={}, tool_id=None,
unstructured_files_directory = job_directory.unstructured_files_directory()
sep = system_properties.get("sep", os.sep)
job_config = {
"job_directory": job_directory.path,
"working_directory": working_directory,
"outputs_directory": outputs_directory,
"configs_directory": configs_directory,
Expand Down
14 changes: 8 additions & 6 deletions pulsar/manager_endpoint_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,27 @@ def submit_job(manager, job_config):
# job_config is raw dictionary from JSON (from MQ or HTTP endpoint).
job_id = job_config.get('job_id')
command_line = job_config.get('command_line')
# Replace the string PULSAR_PATH (given by galaxy) with the actual path,
# which prevents the need for pulsar specific configuration in galaxy, when
# using MQs
PULSAR_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
command_line = command_line.replace('PULSAR_PATH', PULSAR_PATH)

setup_params = job_config.get('setup_params')
remote_staging = job_config.get('remote_staging', {})
dependencies_description = job_config.get('dependencies_description', None)
env = job_config.get('env', [])
submit_params = job_config.get('submit_params', {})

job_config = None
if setup_params:
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)
setup_job(manager, input_job_id, tool_id, tool_version)
job_config = setup_job(manager, input_job_id, tool_id, tool_version)

if job_config is not None:
job_directory = job_config["job_directory"]
jobs_directory = os.path.abspath(os.path.join(job_directory, os.pardir))
command_line = command_line.replace('__PULSAR_JOBS_DIRECTORY__', jobs_directory)

if remote_staging:
# TODO: Handle __PULSAR_JOB_DIRECTORY__ config files, metadata files, etc...
manager.handle_remote_staging(job_id, remote_staging)

dependencies_description = dependencies.DependenciesDescription.from_dict(dependencies_description)
Expand Down

0 comments on commit 44d7a5a

Please sign in to comment.