mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix Pulsar remote metadata temp files for https://github.com/galaxyproject/galaxy/pull/1688/commits/a2e31403753c407e7f6966b69b157e32f5f3ef8a
xref #1688 and https://github.com/galaxyproject/galaxy/commit/2a90811ea37e1361d58538f11500643ff1f537e5
This commit is contained in:
committed by
Dannon Baker
parent
e194c64e26
commit
8d0e1c51df
@@ -1125,12 +1125,21 @@ class JobWrapper( object ):
|
||||
self.app.config, key, default
|
||||
)
|
||||
|
||||
def finish( self, stdout, stderr, tool_exit_code=None, remote_working_directory=None ):
|
||||
def finish(
|
||||
self,
|
||||
stdout,
|
||||
stderr,
|
||||
tool_exit_code=None,
|
||||
remote_working_directory=None,
|
||||
remote_metadata_directory=None,
|
||||
):
|
||||
"""
|
||||
Called to indicate that the associated command has been run. Updates
|
||||
the output datasets based on stderr and stdout from the command, and
|
||||
the contents of the output files.
|
||||
"""
|
||||
# remote_working_directory not used with updated (7.0+ pulsar and 16.04+
|
||||
# originated Galaxy job - keep for a few releases for older jobs)
|
||||
finish_timer = util.ExecutionTimer()
|
||||
|
||||
# default post job setup
|
||||
@@ -1258,12 +1267,15 @@ class JobWrapper( object ):
|
||||
output_filename = self.external_output_metadata.get_output_filenames_by_dataset( dataset, self.sa_session ).filename_out
|
||||
|
||||
def path_rewriter( path ):
|
||||
if not remote_working_directory or not path:
|
||||
if not path:
|
||||
return path
|
||||
normalized_remote_working_directory = os.path.normpath( remote_working_directory )
|
||||
normalized_remote_working_directory = remote_working_directory and os.path.normpath( remote_working_directory )
|
||||
normalized_remote_metadata_directory = remote_metadata_directory and os.path.normpath( remote_metadata_directory )
|
||||
normalized_path = os.path.normpath( path )
|
||||
if normalized_path.startswith( normalized_remote_working_directory ):
|
||||
if remote_working_directory and normalized_path.startswith( normalized_remote_working_directory ):
|
||||
return normalized_path.replace( normalized_remote_working_directory, self.working_directory, 1 )
|
||||
if remote_metadata_directory and normalized_path.startswith( normalized_remote_metadata_directory ):
|
||||
return normalized_path.replace( normalized_remote_metadata_directory, self.working_directory, 1 )
|
||||
return path
|
||||
|
||||
dataset.metadata.from_JSON_dict( output_filename, path_rewriter=path_rewriter )
|
||||
|
||||
@@ -451,6 +451,7 @@ class PulsarJobRunner( AsynchronousJobRunner ):
|
||||
client = self.get_client_from_state(job_state)
|
||||
run_results = client.full_status()
|
||||
remote_working_directory = run_results.get("working_directory", None)
|
||||
remote_metadata_directory = run_results.get("metadata_directory", None)
|
||||
stdout = run_results.get('stdout', '')
|
||||
stderr = run_results.get('stderr', '')
|
||||
exit_code = run_results.get('returncode', None)
|
||||
@@ -482,7 +483,8 @@ class PulsarJobRunner( AsynchronousJobRunner ):
|
||||
stdout,
|
||||
stderr,
|
||||
exit_code,
|
||||
remote_working_directory=remote_working_directory
|
||||
remote_working_directory=remote_working_directory,
|
||||
remote_metadata_directory=remote_metadata_directory,
|
||||
)
|
||||
except Exception:
|
||||
log.exception("Job wrapper finish method failed")
|
||||
|
||||
Reference in New Issue
Block a user