mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Move export_history.py script into lib/galaxy/tools/imp_exp so that it's simpler to execute.
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname $0`
|
||||
python ./scripts/export_history.py $@
|
||||
@@ -54,9 +54,6 @@ class ExportHistoryToolAction( ToolAction ):
|
||||
job_wrapper = JobExportHistoryArchiveWrapper( job )
|
||||
cmd_line = job_wrapper.setup_job( trans, jeha, include_hidden=incoming[ 'include_hidden' ], \
|
||||
include_deleted=incoming[ 'include_deleted' ] )
|
||||
|
||||
# Save jeha.
|
||||
trans.sa_session.flush()
|
||||
|
||||
#
|
||||
# Add parameters to job_parameter table.
|
||||
|
||||
@@ -199,9 +199,10 @@ class JobExportHistoryArchiveWrapper( object, UsesHistory, UsesAnnotations ):
|
||||
options = ""
|
||||
if jeha.compressed:
|
||||
options = "-G"
|
||||
return "%s %s %s %s %s %s" % ( os.path.join( os.path.abspath( os.getcwd() ), "export_history.sh" ), \
|
||||
options, history_attrs_filename, datasets_attrs_filename, \
|
||||
jobs_attrs_filename, jeha.dataset.file_name )
|
||||
return "python %s %s %s %s %s %s" % (
|
||||
os.path.join( os.path.abspath( os.getcwd() ), "lib/galaxy/tools/imp_exp/export_history.py" ), \
|
||||
options, history_attrs_filename, datasets_attrs_filename, jobs_attrs_filename, \
|
||||
jeha.dataset.file_name )
|
||||
|
||||
def cleanup_after_job( self, db_session ):
|
||||
""" Remove temporary directory and attribute files generated during setup for this job. """
|
||||
|
||||
@@ -2,20 +2,13 @@
|
||||
"""
|
||||
Export a history to an archive file using attribute files.
|
||||
|
||||
NOTE: This should not be called directly. Use the set_metadata.sh script in Galaxy's
|
||||
top level directly.
|
||||
|
||||
usage: %prog history_attrs dataset_attrs job_attrs out_file
|
||||
-G, --gzip: gzip archive file
|
||||
-D, --delete_dir: delete attribute files' directory if operation completed successfully
|
||||
"""
|
||||
|
||||
from galaxy import eggs
|
||||
import os, pkg_resources, tempfile, tarfile
|
||||
pkg_resources.require( "bx-python" )
|
||||
import sys, traceback, fileinput
|
||||
from galaxy.util.json import *
|
||||
from warnings import warn
|
||||
from bx.cookbook import doc_optparse
|
||||
import optparse, sys, os, tempfile, tarfile
|
||||
|
||||
def create_archive( history_attrs_file, datasets_attrs_file, jobs_attrs_file, out_file, gzip=False ):
|
||||
""" Create archive from the given attribute/metadata files and save it to out_file. """
|
||||
@@ -63,17 +56,15 @@ def create_archive( history_attrs_file, datasets_attrs_file, jobs_attrs_file, ou
|
||||
# Status.
|
||||
return 'Created history archive.'
|
||||
except Exception, e:
|
||||
return 'Error creating history archive: %s' + str( e ), sys.stderr
|
||||
return 'Error creating history archive: %s' % str( e ), sys.stderr
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Parse command line.
|
||||
options, args = doc_optparse.parse( __doc__ )
|
||||
try:
|
||||
gzip = bool( options.gzip )
|
||||
delete_dir = bool( options.delete_dir )
|
||||
history_attrs, dataset_attrs, job_attrs, out_file = args
|
||||
except:
|
||||
doc_optparse.exception()
|
||||
parser = optparse.OptionParser()
|
||||
parser.add_option( '-G', '--gzip', dest='gzip', action="store_true", help='Compress archive using gzip.' )
|
||||
(options, args) = parser.parse_args()
|
||||
gzip = bool( options.gzip )
|
||||
history_attrs, dataset_attrs, job_attrs, out_file = args
|
||||
|
||||
# Create archive.
|
||||
status = create_archive( history_attrs, dataset_attrs, job_attrs, out_file, gzip )
|
||||
Reference in New Issue
Block a user