[ARVADOS] updated: ec7cd27f399097d76822eb05867102e2b7d19be7

git at public.curoverse.com git at public.curoverse.com
Thu Jan 8 22:08:55 EST 2015


Summary of changes:
 sdk/cli/bin/crunch-job                               | 13 +++++++++++++
 services/api/app/models/collection.rb                | 20 ++++++++++++--------
 .../migrate/20141208174653_collection_file_names.rb  | 10 ++--------
 .../arvados/v1/collections_controller_test.rb        |  4 ++--
 services/api/test/unit/collection_test.rb            |  2 +-
 5 files changed, 30 insertions(+), 19 deletions(-)

       via  ec7cd27f399097d76822eb05867102e2b7d19be7 (commit)
       via  226d028a3493a2b2c539449133f6742650a19d04 (commit)
       via  42fec323465b515e85a8bd460b2cee7972abd658 (commit)
       via  5523be76b00bc58cf9568cf7a1353326c6795cac (commit)
       via  55fc92b5f382b964b65c952f047bc673df582d98 (commit)
       via  38891aedbd12a4a04a7009edc1203fadf564af46 (commit)
       via  1ea3251891770887654a3d9ae68f5f1cf7f1d689 (commit)
       via  f15b218327029a379264db6997a85b2d2835088a (commit)
      from  11c04627d0fd81782d6fff890412c7a820cb370a (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 ec7cd27f399097d76822eb05867102e2b7d19be7
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Jan 8 21:51:14 2015 -0500

    4523: update migration script to use sql to set file_names

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 6c5e1ac..423555b 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -129,18 +129,22 @@ class Collection < ArvadosModel
 
   def set_file_names
     if self.manifest_text_changed?
-      file_names = []
-      if self.manifest_text
-        self.manifest_text.split.each do |part|
-          file_name = part.rpartition(':')[-1]
-          file_names << file_name if file_name != '.'
-        end
-      end
-      self.file_names = file_names.uniq.join(" ")[0,2**13]
+      self.file_names = Collection.manifest_files self.manifest_text
     end
     true
   end
 
+  def self.manifest_files manifest_text
+    names = ''
+    if manifest_text
+      manifest_text.scan(/ \d+:\d+:(\S+)/) do |name|
+        names << name.first.gsub('\040',' ') + "\n" 
+        break if names.length > 2**13
+      end
+    end
+    names[0,2**13]
+  end
+
   def check_encoding
     if manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?
       true
diff --git a/services/api/db/migrate/20141208174653_collection_file_names.rb b/services/api/db/migrate/20141208174653_collection_file_names.rb
index 8cccbba..51b4746 100644
--- a/services/api/db/migrate/20141208174653_collection_file_names.rb
+++ b/services/api/db/migrate/20141208174653_collection_file_names.rb
@@ -7,14 +7,8 @@ class CollectionFileNames < ActiveRecord::Migration
     act_as_system_user do
       Collection.all.each do |c|
         if c.manifest_text
-          file_names = []
-          c.manifest_text.split.each do |part|
-            file_name = part.rpartition(':')[-1]
-            file_names << file_name if file_name != '.'
-          end
-
-          c.file_names = file_names.uniq.join(" ")[0,2**13]
-          c.save!
+          file_names = Collection.manifest_files c.manifest_text
+          update_sql "UPDATE collections SET file_names = '#{file_names}' WHERE uuid = '#{c.uuid}'"
         end
       end
     end

commit 226d028a3493a2b2c539449133f6742650a19d04
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Jan 8 14:57:58 2015 -0500

    4523: slightly improved large description

diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index 3023c9f..ed56b62 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -679,9 +679,9 @@ EOS
           and expect response #{expected_response}" do
       authorize_with :active
 
-      description = ''
+      description = 'here is a collection with a very large description'
       while description.length < description_size
-        description += 'a'
+        description = description + description
       end
 
       post :create, collection: {
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index 9253ddd..0134ec2 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -62,7 +62,7 @@ class CollectionTest < ActiveSupport::TestCase
         manifest_text = '. d41d8cd98f00b204e9800998ecf8427e+0'
         index = 0
         while manifest_text.length < manifest_size
-          manifest_text += ' ' + "0:0:longlongfile#{index}.txt"
+          manifest_text += ' ' + "0:0:veryverylongfilename000000000000#{index}.txt"
           index += 1
         end
         manifest_text += "\n"

commit 42fec323465b515e85a8bd460b2cee7972abd658
Merge: 11c0462 5523be7
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Thu Jan 8 14:45:47 2015 -0500

    Merge branch 'master' into 4523-search-index


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list