Skip to content

Using thread pool to transform records#9

Open
allenwq wants to merge 2 commits into
lowjoel:masterfrom
allenwq:multi-threading
Open

Using thread pool to transform records#9
allenwq wants to merge 2 commits into
lowjoel:masterfrom
allenwq:multi-threading

Conversation

@allenwq

@allenwq allenwq commented Apr 15, 2016

Copy link
Copy Markdown
Contributor

Pending to add README..

@allenwq

allenwq commented Apr 15, 2016

Copy link
Copy Markdown
Contributor Author

@lowjoel No idea why I get No connection pool for ActiveRecord::Base (ActiveRecord::ConnectionNotEstablished) in travis, it was fine in my local.

Comment thread lib/database_transform/schema.rb Outdated
delegate :around_job, :thread, to: :class
class << self
# Store the block if a block is given, otherwise the stored block will be returned.
def around_job(&block)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would define these outside the self singleton class, to be consistent with transform_table

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, should around_job be composable? Multiple around_job should cause it to chain?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of a use case for multiple around jobs ><

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but that's the behaviour expected of most Ruby around_X callbacks.

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

@lowjoel I tried included a Gemfile.lock (make sure travis uses the same gems as my local) and change the ruby versions, all does not work very well...

@lowjoel

lowjoel commented Apr 28, 2016

Copy link
Copy Markdown
Owner

@allenwq gemfile.lock doesn't affect gems, so that won't work. What are you trying to achieve?

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

It affects the gems install on travis for testing right ?

@lowjoel

lowjoel commented Apr 28, 2016

Copy link
Copy Markdown
Owner

Yes, but what's the problem you're trying to solve?

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

Oh, Tests passed on my local, but cannot even run on travis

@lowjoel

lowjoel commented Apr 28, 2016

Copy link
Copy Markdown
Owner

I don't think it's a gem version problem. Have you tried with a linux VM?

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

...master fails on my linux server > <

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

So it's not my PR breaks the travis, @lowjoel can you verify ?

@lowjoel

lowjoel commented Apr 28, 2016

Copy link
Copy Markdown
Owner

@allenwq https://travis-ci.org/lowjoel/database_transform/builds/126300182, just committed 2 hours ago, finished running 1 minute ago...

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

Sorry, I was using the wrong master > <

But now I can get it fail locally, will debug and get back to you.

@lowjoel

lowjoel commented Apr 28, 2016

Copy link
Copy Markdown
Owner

Thanks! I wanted to try but my VirtualBox VM can't get internet...

@allenwq

allenwq commented Apr 28, 2016

Copy link
Copy Markdown
Contributor Author

Wait.. even I changed the master it's still failing, I was in commit a913457

ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

/home/allen/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:570:in `retrieve_connection': No connection pool for ActiveRecord::Base (ActiveRecord::ConnectionNotEstablished)
    from /home/allen/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    from /home/allen/.rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in `connection'
    from /home/allen/ruby-dev/database_transform/spec/support/sample_database.rb:37:in `<class:Base>'
    from /home/allen/ruby-dev/database_transform/spec/support/sample_database.rb:36:in `block in <top (required)>'
    from /home/allen/.rvm/gems/ruby-2.3.0/gems/rspec-core-3.4.4/lib/rspec/core.rb:97:in `configure'
    from /home/allen/ruby-dev/database_transform/spec/support/sample_database.rb:1:in `<top (required)>'
    from /home/allen/ruby-dev/database_transform/spec/spec_helper.rb:9:in `require'
    from /home/allen/ruby-dev/database_transform/spec/spec_helper.rb:9:in `block in <top (required)>'

It's weird that your commit passes travis and it fails on my linux with the same exception as my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants