Acutally caused by the instance.condor_job_id field being too short. This expands this field (so long as condor can handle a job id of this length)
--- src/app/models/instance.rb | 1 + src/db/migrate/20090804142049_create_instances.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index 22069e2..e3d65bc 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -47,6 +47,7 @@ class Instance < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => :pool_id validates_length_of :name, :maximum => 1024 + validates_length_of :condor_job_id, :maximum => 2048, :unless => Proc.new { |i| i.condor_job_id.nil? }
STATE_NEW = "new" STATE_PENDING = "pending" diff --git a/src/db/migrate/20090804142049_create_instances.rb b/src/db/migrate/20090804142049_create_instances.rb index e6ba245..e943f17 100644 --- a/src/db/migrate/20090804142049_create_instances.rb +++ b/src/db/migrate/20090804142049_create_instances.rb @@ -33,7 +33,7 @@ class CreateInstances < ActiveRecord::Migration t.string :public_address t.string :private_address t.string :state - t.string :condor_job_id + t.string :condor_job_id, :limit => 2048 t.string :last_error t.integer :instance_key_id t.integer :lock_version, :default => 0
On Thu, 2010-11-04 at 16:53 -0400, Mohammed Morsi wrote:
src/app/models/instance.rb | 1 + src/db/migrate/20090804142049_create_instances.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index 22069e2..e3d65bc 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -47,6 +47,7 @@ class Instance < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => :pool_id validates_length_of :name, :maximum => 1024
validates_length_of :condor_job_id, :maximum => 2048, :unless => Proc.new { |i| i.condor_job_id.nil? }
STATE_NEW = "new" STATE_PENDING = "pending"
diff --git a/src/db/migrate/20090804142049_create_instances.rb b/src/db/migrate/20090804142049_create_instances.rb index e6ba245..e943f17 100644 --- a/src/db/migrate/20090804142049_create_instances.rb +++ b/src/db/migrate/20090804142049_create_instances.rb @@ -33,7 +33,7 @@ class CreateInstances < ActiveRecord::Migration t.string :public_address t.string :private_address t.string :state
t.string :condor_job_id
t.string :condor_job_id, :limit => 2048 t.string :last_error t.integer :instance_key_id t.integer :lock_version, :default => 0
Hmm, I thought we were doing migrations now? Or is that only for the beta branch?
Is this any different from using 'text' instead of 'string'?
Ian
On 11/29/2010 02:55 PM, Ian Main wrote:
On Thu, 2010-11-04 at 16:53 -0400, Mohammed Morsi wrote:
src/app/models/instance.rb | 1 + src/db/migrate/20090804142049_create_instances.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/app/models/instance.rb b/src/app/models/instance.rb index 22069e2..e3d65bc 100644 --- a/src/app/models/instance.rb +++ b/src/app/models/instance.rb @@ -47,6 +47,7 @@ class Instance< ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name, :scope => :pool_id validates_length_of :name, :maximum => 1024
validates_length_of :condor_job_id, :maximum => 2048, :unless => Proc.new { |i| i.condor_job_id.nil? }
STATE_NEW = "new" STATE_PENDING = "pending"
diff --git a/src/db/migrate/20090804142049_create_instances.rb b/src/db/migrate/20090804142049_create_instances.rb index e6ba245..e943f17 100644 --- a/src/db/migrate/20090804142049_create_instances.rb +++ b/src/db/migrate/20090804142049_create_instances.rb @@ -33,7 +33,7 @@ class CreateInstances< ActiveRecord::Migration t.string :public_address t.string :private_address t.string :state
t.string :condor_job_id
t.string :condor_job_id, :limit => 2048 t.string :last_error t.integer :instance_key_id t.integer :lock_version, :default => 0
Hmm, I thought we were doing migrations now? Or is that only for the beta branch?
Is this any different from using 'text' instead of 'string'?
Ian
Thanks for the feedback, just sent an updated patch creating a new migration. I'm still using string as I think a text field would be a bit overkill in this case. Honestly doesn't matter to me, if you think text would be more appropriate, I can just update the patch to use that.
-Mo
--- src/spec/models/instance_spec.rb | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/spec/models/instance_spec.rb b/src/spec/models/instance_spec.rb index ee9cbaf..e47cb4c 100644 --- a/src/spec/models/instance_spec.rb +++ b/src/spec/models/instance_spec.rb @@ -42,6 +42,14 @@ describe Instance do
end
+ it "should have a condor_job_id of reasonable length" do + @instance.condor_job_id = 'x'*2049 + @instance.should_not be_valid + @instance.condor_job_id = 'x'*2048 + @instance.should be_valid + + end + it "should have unique name" do @instance.save! second_instance = Factory.build(:instance,
deltacloud-devel@lists.fedorahosted.org