Created
May 24, 2012 18:40
-
-
Save treeder/2783383 to your computer and use it in GitHub Desktop.
For IronWorker CLI Blog Post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "token": "MY_TOKEN", | |
| "project_id": "MY_PROJECT_ID" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # define the runtime language, this can be ruby, java, node, php, go, etc. | |
| runtime "ruby" | |
| # exec is the file that will be executed: | |
| exec "hello_worker.rb" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Worker code can be anything you want. | |
| puts "Starting HelloWorker at #{Time.now}" | |
| puts "Payload: #{params}" | |
| puts "Simulating hard work for 5 seconds..." | |
| 5.times do |i| | |
| puts "Sleep #{i}..." | |
| sleep 1 | |
| end | |
| puts "HelloWorker completed at #{Time.now}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require "iron_worker_ng" | |
| client = IronWorkerNG::Client.new | |
| 100.times do | |
| client.tasks.create("hello", "foo"=>"bar") | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment