[ARVADOS] updated: 554728c26640c8ac26c3e97b5c3e06b6e4be3e15

git at public.curoverse.com git at public.curoverse.com
Tue Jan 13 13:43:19 EST 2015


Summary of changes:
 docker/base/Dockerfile                             |   2 +-
 sdk/cli/bin/arv                                    | 318 ++++++++++-----------
 services/api/app/models/collection.rb              |  16 +-
 .../20141208174653_collection_file_names.rb        |  10 +-
 4 files changed, 161 insertions(+), 185 deletions(-)

       via  554728c26640c8ac26c3e97b5c3e06b6e4be3e15 (commit)
       via  e5ed756501133df3fbcce69399da46439a8d3e6c (commit)
       via  5f4ca24ce0d52857901664c3bb5e228316af4d74 (commit)
       via  138a4b0a5de177faede5255841a5c6fca06b31f4 (commit)
       via  cb15699af6eb0cad3560280b741a135b9af57a80 (commit)
       via  9fea1c7774bd256788ee76385c0eab05d4508796 (commit)
       via  5fa38c36644bd122b8c31601aa864f05bf4fba73 (commit)
       via  198963abf16d86d809a6a9fde36bc9ffd74685fd (commit)
       via  8295ba721133c341fd72350f7ca9438d1a99cdbe (commit)
      from  a66a265608dbde7f3dd02dcd64ffba55f6a772fd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 554728c26640c8ac26c3e97b5c3e06b6e4be3e15
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Jan 13 13:39:29 2015 -0500

    4523: update migrate script to use batch size and instance method on collection.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index d112e09..8258d1f 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -129,23 +129,23 @@ class Collection < ArvadosModel
 
   def set_file_names
     if self.manifest_text_changed?
-      self.file_names = Collection.manifest_files self.manifest_text
+      self.file_names = manifest_files
     end
     true
   end
 
-  def self.manifest_files manifest_text
+  def manifest_files
     names = ''
-    if manifest_text
-      manifest_text.scan(/ \d+:\d+:(\S+)/) do |name|
-        names << name.first.gsub('\040',' ') + "\n" 
+    if self.manifest_text
+      self.manifest_text.scan(/ \d+:\d+:(\S+)/) do |name|
+        names << name.first.gsub('\040',' ') + "\n"
         break if names.length > 2**13
       end
     end
 
-    if manifest_text and names.length < 2**13
-      manifest_text.scan(/^\.\/(\S+)/m) do |stream_name|
-        names << stream_name.first.gsub('\040',' ') + "\n" 
+    if self.manifest_text and names.length < 2**13
+      self.manifest_text.scan(/^\.\/(\S+)/m) do |stream_name|
+        names << stream_name.first.gsub('\040',' ') + "\n"
         break if names.length > 2**13
       end
     end
diff --git a/services/api/db/migrate/20141208174653_collection_file_names.rb b/services/api/db/migrate/20141208174653_collection_file_names.rb
index 51b4746..fdcd95f 100644
--- a/services/api/db/migrate/20141208174653_collection_file_names.rb
+++ b/services/api/db/migrate/20141208174653_collection_file_names.rb
@@ -5,11 +5,11 @@ class CollectionFileNames < ActiveRecord::Migration
     add_column :collections, :file_names, :string, :limit => 2**13
 
     act_as_system_user do
-      Collection.all.each do |c|
-        if c.manifest_text
-          file_names = Collection.manifest_files c.manifest_text
-          update_sql "UPDATE collections SET file_names = '#{file_names}' WHERE uuid = '#{c.uuid}'"
-        end
+      Collection.find_each(batch_size: 20) do |c|
+        file_names = c.manifest_files
+        update_sql "UPDATE collections
+                    SET file_names = #{ActiveRecord::Base.connection.quote(file_names)}
+                    WHERE uuid = '#{c.uuid}'"
       end
     end
   end

commit e5ed756501133df3fbcce69399da46439a8d3e6c
Merge: a66a265 5f4ca24
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Jan 13 12:03:56 2015 -0500

    Merge branch 'master' into 4523-search-index


-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list