Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blender-zk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blender-zk

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Blender::Zk

Zookeeper integration for blender. It allows Blender to use zookeeper for locking. Blender jobs running in different nodes can synchornize/coordinate using zookeeper.

Installation

Add this line to your application's Gemfile:

gem 'blender-zk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install blender-zk

Usage

  • Blender by default used file based locking (flock/fcntl) for locking. You have to explicitly tell blender to use zookeeper locking interface. This can be done using the lock_options DSL method. It take the locking driver name ('zk' in our case).
Blender.blend('test-1') do |sched|
  sched.members(['localhost'])
  sched.lock_options('zk')
  sched.ruby_task('date') do
    execute do
      sleep 10
      puts 'This will succeed'
    end
  end
end

## in another script
Blender.blend('test-1') do |sched|
  sched.members(['localhost'])
  sched.lock_options('zk')
  sched.ruby_task('date') do
    execute do
      puts 'This will fail, if both jobs are triggered at the same time '
    end
  end
end

By default blender-zk will use the job name 'test-1' as key name. This, and other options (lock wait timeout, chroot etc) can be passed as option

Blender.blend('test-1') do |sched|
  sched.members(['localhost'])
  sched.lock_options('zk', path: '/path/to/lock')
  sched.ruby_task('date') do
    execute do
      sleep 3
    end
  end
end
### in another script
Blender.blend('test-2') do |sched|
  sched.members(['localhost'])
  sched.lock_options('zk', path: '/path/to/lock', timeout: 5)
  sched.ruby_task('date') do
    execute do
      puts 'This wont fail, since it will wait 5 second, by then the first job will finish'
    end
  end
end

License

Apache 2

Contributing

  1. Fork it ( https://github.com/[my-github-username]/blender-zk/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

FAQs

Package last updated on 10 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc