iron-io / iron_worker_ruby_ng Goto Github PK
View Code? Open in Web Editor NEWNext Gen Ruby gem for IronWorker
Home Page: www.iron.io
License: BSD 2-Clause "Simplified" License
Next Gen Ruby gem for IronWorker
Home Page: www.iron.io
License: BSD 2-Clause "Simplified" License
[/Users/chad/workspace/iron/hud/workers] # iron_worker queue --help
Using typhoeus gem.
E, [#330] ERROR -- IronWorkerNG: Both token and project_id must be specified
/usr/local/lib/ruby/gems/1.9.1/gems/iron_worker_ng-0.7.4/lib/iron_worker_ng/api_client.rb:21:in `initialize': Both token and project_id must be specified (IronCore::IronError)
I see double log output with this code:
p client.tasks.log(task_id)
Like our current wait_until_complete.
otherwise previous runs may screw up the results
For instance, if I have script/pop_reader.worker
and I run iron_worker upload script/pop_reader
, it will name the worker "script/pop_reader". It should be named pop_reader
.
@Gissues:{"order":42.85714285714287,"status":"backlog"}
In README document how to pass in an API argument such as priority. Current not shown here.
eg: IronWorkerNG::Code::Base.new(workerfile: "workers/sleepy.worker")
eg. ("I, [2012-05-31T16:47:23.065196 #997] INFO --")
@Gissues:{"order":50,"status":"done"}
We've had several people that don't know what's going on, but turns out it's picking up the wrong credentials. It should say: "Uploading to project: #{project_id}..." or something.
Re: #63
When trying to upload a code package using an incorrect token/project_id, user simply sees a 401 Rest error
/usr/local/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!': 401 Unauthorized (RestClient::Unauthorized)
Should return something much more meaningful like
401 Unauthorized Error: This may be due to an incorrect token or project_id
@Gissues:{"order":75,"status":"inprogress"}
Make it two separate boxes or something.
Impossible for user to debug otherwise.
I tried scheduling a task to run every 30 seconds and API returned
400 Bad Request (Rest::Wrappers::RestClientExceptionWrapper)
Took me 15 minutes to figure out that run_every's minimum is 60 seconds. Needs to be handled here as well as in our docs.
eg:
iron_worker upload script/pop_reader -n pop_reader
Returns:
E, [#19693] ERROR -- IronWorkerNG: No exec specified
/usr/lib/ruby/gems/1.9.1/gems/iron_worker_ng-0.6.3/lib/iron_worker_ng/code/base.rb:94:in `create_zip': No exec specified (IronCore::IronError)
from /usr/lib/ruby/gems/1.9.1/gems/iron_worker_ng-0.6.3/lib/iron_worker_ng/client.rb:59:in `codes_create'
from /usr/lib/ruby/gems/1.9.1/gems/iron_worker_ng-0.6.3/lib/iron_worker_ng/client.rb:16:in `method_missing'
from /usr/lib/ruby/gems/1.9.1/gems/iron_worker_ng-0.6.3
@Gissues:{"order":7.142857142857152,"status":"backlog"}
I see that you modified puts
calls to IronIO::Logger
. Well, while this is better than writing to the console unconditionally, there is still a lot of undesirable output going to the console through the info
call. For instance,
Calling tasks.create with code_name=...
Can you please make sure there is no output at all coming from the gem unless I explicitly tell it to be verbose? Thanks.
eg:
iron_worker install hello
which will read file and install dependencies (ie: gem's for a ruby worker).@Gissues:{"order":50,"status":"inprogress"}
@Gissues:{"order":78.57142857142858,"status":"backlog"}
I ran into a problem earlier where heroku was trying to cache my app directory, which threw an error because of the worker I had in there. We had a chat about how workers may be uploaded outside of the app.
2 possible solutions brought up were:
I suggested that it might be a good idea to wrap this inside the ng gems and see how well it works.
Thanks!
It feels a lot more natural to have a flag to set it and it's a very common thing. Don't need one for token though.
Example:
iron_worker upload -project_id MYID my_worker
Something like that.
@Gissues:{"order":50,"status":"notstarted"}
Current:
treeder@ubuntu:~/dev/tmp/myapp$ iron_worker upload hello
I, [2012-06-06T13:47:29.499810 #14685] INFO -- IronWorkerNG: Merging ruby exec with path='hello_worker.rb' and class=''
I, [2012-06-06T13:47:29.499953 #14685] INFO -- IronWorkerNG: Fixating gems dependencies
@Gissues:{"order":87.5,"status":"notstarted"}
Not through core, but something like:
IronWorkerNG.logger.level = Logger::DEBUG
For instance, let's say my worker file (my_worker.worker) has:
exec 'my_worker.rb'
file '../models/my_model.rb'
And my worker has:
require 'my_model'
Running ruby my_worker.rb obviously won't work.
iron_worker run_local my_worker
would package it up as if it were about to be sent to IronWorker, then runs it.
@Gissues:{"order":64.2857142857143,"status":"backlog"}
test_wrong_merges test case from test_common_merges addresses the problem
ie:
It's hard to find what's important in the readme.
@Gissues:{"order":85.71428571428572,"status":"backlog"}
I get a 301 response if I create the client like this:
client = IronWorkerNG::Client.new()
again
@iced could you please check they are not broken before commit?
iron_worker upload some_dir/my_worker
goes through the upload and looks like it works, but the worker is never actually updated.
cd some_dir
iron_worker upload my_worker
this obviously works.
So they are consolidated in one place... or move themout of iron_worker_examples. Either way they should nto be duplicated.
@Gissues:{"order":71.42857142857144,"status":"backlog"}
A follow up to #79 is to get this example: https://github.com/iron-io/iron_worker_examples/tree/master/ruby_ng/image_processing
working like this:
Extra points (optional):
Pass in which image operations should be performed and the values required to perform them, for eg:
[ "generate_thumb": {"width": 200, "height": 200, "format": "jpg"}, "operation2":....]
Library API was changed by commit romand@b0d4801
The way code objects are created have been changed: instead of
code = Code::Ruby.new(:workerfile => 'common.worker') do
name 'asdf'
exec 'worker.rb'
end
or
code = Code::Creator.create do
runtime 'ruby'
...
end
now we write
code = Code.new(:runtime => 'ruby') do
...
end
or
code = Code.new do
runtime 'ruby'
...
end
or
code = Code.new
code.runtime 'ruby'
...
or
code = Code.new(:workerfile => 'cool.worker') # with runtime set in workerfile
Before the change, block passed to Code::Creator.create was executed twice:
Workerfiles content was executed twice, too.
In order to eliminate such unexpected and buggy behavior, code of subclasses was moved to modules with corresponding names, and those modules are mixed in code object when 'runtime' method is called.
As the result,
The one way to protect customers from suddenly broken code, we can
class Code
class Ruby
def initialize(*args, &block)
IronCore::Logger.warn 'Code::Ruby.new is deprecated, call Code.new(:runtime => "ruby") instead'
Code.new(...)
end
end
end
Another way is just to document this change (in changelog, readme ...) and let customers make (quick!) fix in their code.
https://github.com/iron-io/iron_worker_ruby_ng/blob/master/lib/iron_worker_ng/code/base.rb#L48
Seems like worke
should be worker
, which might explain why I was having some trouble passing :worker => 'test_linux' :name="GoTest".
for example, when I forget to add code.merge_worker 'some_worker' I get:
[/Users/chad/workspace/iron/test/ng] # ruby upload.rb
/usr/local/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in return!': 400 Bad Request (RestClient::BadRequest) from /usr/local/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in
process_result'
from /usr/local/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in block in transmit' from /usr/local/lib/ruby/1.9.1/net/http.rb:627:in
start'
Would be MUCH better to have output that tried to understand what the problem is and said "You have not included a worker file with your code package"
or something liek that
If so, can you add to examples to wait then get log?
AFTER
------> Detecting Configuration
Found configuration in working directory
Working with project 'Test Project' (project_id: '4e25e1d25c0dd27801000283')
------> Discovering .worker file
Found .worker file 'hello.worker'
[Ruby | PHP | .NET | Go | Binary] worker detected with path = 'hello_worker.rb'
Class name has been set to 'MyTestWorker'
------> Creating worker package
Worker upload started
------> Worker deployed with version r15
https://hud.iron.io/tq/projects/4e25e1d25c0dd27801000283/code/4fc7e44451ef0d2807087604
BEFORE
Working with project 'Test Project' ('4e25e1d25c0dd27801000283')
Using workerfile 'hello.worker'
Merging ruby exec with path='hello_worker.rb' and class=''
Worker 'hello' upload started
Worker 'hello' uploaded
Is there a quick and elegant way to reschedule (update) workers without having to unschedule the old one and schedule the new one?
eg:
iron_mq = IronMQ::Client.new('token' => @config["iron"]["token"], 'project_id' => @config["iron"]["project_id"])
(more to come)
already wanted by customers
very handy, too
Token should go first because project_id could become optional for certain things like getting a list of projects.
Returns the full URL to the webhook
this would be wicked cool. good/bad idea?
by numerous requests
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.