diff --git a/BrainPortal/app/controllers/tasks_controller.rb b/BrainPortal/app/controllers/tasks_controller.rb
index 57ccf5ef9..00f1266c7 100644
--- a/BrainPortal/app/controllers/tasks_controller.rb
+++ b/BrainPortal/app/controllers/tasks_controller.rb
@@ -707,12 +707,14 @@ def operation
archive_dp_id = params[:archive_dp_id].presence # for 'archive as file' operation
dup_bourreau_id = nil unless dup_bourreau_id && Bourreau.find_all_accessible_by_user(current_user).where(:id => dup_bourreau_id).exists?
archive_dp_id = nil unless archive_dp_id && DataProvider.find_all_accessible_by_user(current_user).where(:id => archive_dp_id).exists?
+ nozip = params[:nozip].presence # for archiving without compression
# This does the actual work and returns info about the
# successes and failures.
results = apply_operation(operation, tasklist,
:dup_bourreau_id => dup_bourreau_id,
:archive_dp_id => archive_dp_id,
+ :nozip => nozip
)
# Prepare counters for how many tasks affected.
@@ -748,6 +750,7 @@ def apply_operation(operation, taskids, options = {})
# Some other parameters
dup_bourreau_id = options[:dup_bourreau_id] # for 'duplicate' operation
archive_dp_id = options[:archive_dp_id] # for 'archive as file' operation
+ nozip = options[:nozip] # for 'archive as file' and 'archive' operation
# Prepare counters for how many tasks affected.
skipped_list = {}
@@ -817,6 +820,9 @@ def apply_operation(operation, taskids, options = {})
bac_klass = operation_to_bac[operation]
if bac_klass
bac = bac_klass.local_new(current_user.id, oktasks.map(&:id), bid, {})
+ # an option for archive or archive to file operations
+ bac.options[:nozip] = nozip if operation =~ /^archive(_file)?$/
+ # other options and operations
bac.options[:archive_data_provider_id] = archive_dp_id if operation == 'archive_file'
bac.options[:dup_bourreau_id] = dup_bourreau_id if operation == 'duplicate'
bac.options[:atwhat] = 'Setup' if operation == 'restart_setup'
diff --git a/BrainPortal/app/models/cluster_task.rb b/BrainPortal/app/models/cluster_task.rb
index 43d390d8c..502344751 100644
--- a/BrainPortal/app/models/cluster_task.rb
+++ b/BrainPortal/app/models/cluster_task.rb
@@ -1307,9 +1307,9 @@ def capture_job_out_err(run_number=nil,stdout_lim=2000,stderr_lim=2000)
# Work Directory Archiving API
##################################################################
- def in_situ_workdir_archive_file #:nodoc:
+ def in_situ_workdir_archive_file(nozip: false) #:nodoc:
fn_id = self.fullname.gsub(/[^\w\-]+/,"_").sub(/\A_*/,"").sub(/_*$/,"")
- "CbrainTask_Workdir_#{fn_id}.tar.gz" # note: also check in the TaskWorkdirArchive model
+ "CbrainTask_Workdir_#{fn_id}.tar#{'.gz' unless nozip}" # note: also check in the TaskWorkdirArchive model
end
# This method will create a .tar.gz file of the
@@ -1320,7 +1320,7 @@ def in_situ_workdir_archive_file #:nodoc:
# in_situ_workdir_archive_file(). Restoring the
# state of the workdir can be performed with
# unarchive_work_directory().
- def archive_work_directory
+ def archive_work_directory(nozip: false)
# Keep updated_at value in order to reset it at the end of method
updated_at_value = self.updated_at
@@ -1381,7 +1381,7 @@ def archive_work_directory
system("chmod","-R","u+rwX",".") # uppercase X mode affects only directories
status = with_stdout_stderr_capture(tar_capture) do
- system("tar","-czf", temp_tar_file, "--exclude", "*#{temp_tar_file}", ".")
+ system("tar","-c#{'z' unless nozip }f", temp_tar_file, "--exclude", "*#{temp_tar_file}", ".")
$? # a Process::Status object
end
diff --git a/BrainPortal/app/views/tasks/_task_menu.html.erb b/BrainPortal/app/views/tasks/_task_menu.html.erb
index ddf2e1478..eeb9d8469 100644
--- a/BrainPortal/app/views/tasks/_task_menu.html.erb
+++ b/BrainPortal/app/views/tasks/_task_menu.html.erb
@@ -193,6 +193,9 @@
Optional: when archiving As File, choose a destination Data Provider:
<%= data_provider_select :archive_dp_id, { :selector => "" }, :include_blank => "" %>