mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix history import job done before import complete
By moving history import from job wrapper cleanup to exec_after_process. That seems like a better location overall, and in particular runs the actual import before we set the final job state.
This commit is contained in:
@@ -1731,7 +1731,11 @@ class JobWrapper(HasResourceParameters):
|
||||
# Certain tools require tasks to be completed after job execution
|
||||
# ( this used to be performed in the "exec_after_process" hook, but hooks are deprecated ).
|
||||
param_dict = self.get_param_dict(job)
|
||||
self.tool.exec_after_process(self.app, inp_data, out_data, param_dict, job=job, final_job_state=final_job_state)
|
||||
try:
|
||||
self.tool.exec_after_process(self.app, inp_data, out_data, param_dict, job=job, final_job_state=final_job_state)
|
||||
except Exception:
|
||||
log.exception(f"exec_after_process hook failed for job {self.job_id}")
|
||||
final_job_state = job.states.ERROR
|
||||
# Call 'exec_after_process' hook
|
||||
self.tool.call_hook('exec_after_process', self.app, inp_data=inp_data,
|
||||
out_data=out_data, param_dict=param_dict,
|
||||
@@ -1834,7 +1838,6 @@ class JobWrapper(HasResourceParameters):
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
self.external_output_metadata.cleanup_external_metadata(self.sa_session)
|
||||
galaxy.tools.imp_exp.JobImportHistoryArchiveWrapper(self.app, self.job_id).cleanup_after_job()
|
||||
if delete_files:
|
||||
self.object_store.delete(self.get_job(), base_dir='job_work', entire_dir=True, dir_only=True, obj_dir=True)
|
||||
except Exception:
|
||||
|
||||
@@ -55,6 +55,7 @@ from galaxy.tools.actions.data_manager import DataManagerToolAction
|
||||
from galaxy.tools.actions.data_source import DataSourceToolAction
|
||||
from galaxy.tools.actions.model_operations import ModelOperationToolAction
|
||||
from galaxy.tools.cache import ToolDocumentCache
|
||||
from galaxy.tools.imp_exp import JobImportHistoryArchiveWrapper
|
||||
from galaxy.tools.parameters import (
|
||||
check_param,
|
||||
params_from_strings,
|
||||
@@ -2649,6 +2650,12 @@ class ExportHistoryTool(Tool):
|
||||
class ImportHistoryTool(Tool):
|
||||
tool_type = 'import_history'
|
||||
|
||||
def exec_after_process(self, app, inp_data, out_data, param_dict, job, final_job_state=None, **kwds):
|
||||
super().exec_after_process(app, inp_data, out_data, param_dict, job=job, **kwds)
|
||||
if final_job_state != DETECTED_JOB_STATE.OK:
|
||||
return
|
||||
JobImportHistoryArchiveWrapper(self.app, job.id).cleanup_after_job()
|
||||
|
||||
|
||||
class InteractiveTool(Tool):
|
||||
tool_type = 'interactive'
|
||||
|
||||
Reference in New Issue
Block a user