Skip to content
This repository has been archived by the owner on Mar 13, 2021. It is now read-only.

Writing functions in Ruby #226

Closed
crdant opened this issue Jan 2, 2018 · 9 comments
Closed

Writing functions in Ruby #226

crdant opened this issue Jan 2, 2018 · 9 comments

Comments

@crdant
Copy link

crdant commented Jan 2, 2018

Hi Team,

I spent some time at a coffee shop working on a function invoker for Ruby. It's at

https://github.com/crdant/ruby-function-invoker

and yours for the taking. Allows for Procs and lambdas to be used a functions.

Chuck

@kingdonb
Copy link

Thank you! I'll test it out

@kingdonb
Copy link

It looks like this needs to be packaged as a YAML file since invoker CRD was introduced in 0.0.6

I'm working on it... this doesn't look too hard

@crdant
Copy link
Author

crdant commented Jul 22, 2018 via email

@kingdonb
Copy link

I've got it working at e776ee9

kingdonb/ruby-function-invoker

There's v0.0.3 that I just tagged on my own fork at https://raw.githubusercontent.com/kingdonb/ruby-function-invoker/v0.0.3/ruby-invoker.yaml which anyone can use if you want to try something that was just tested against riff 0.0.7

This is not production-grade which you can tell by the version, and there's a lot of things I have left out because I just got here and don't know generally what gRPC is for or much of anything else. I just used the http protocol, which none of the bundled invokers still appear to be supporting, but it is there and still able to be used in riff invoker spec nonetheless...

I added a sample that shows the user how to supply a Gemfile

🍻🍺🍻

Thanks for providing the community with a great example! Here's my chip-in

@kingdonb
Copy link

Shout at kingdonb/ruby-function-invoker#2 where the latest incarnation lives for now

@kingdonb
Copy link

Something I'm not understanding, or something that doesn't work right for me... I am on riff master and I see the new Link resource, but...

When I set partition on the topic to 7 which seems to be a number of workers that my minikube can pretty handily keep alive and stable, I then went into minikube and top filter for COMMAND=ruby processes, and I can see the 7 processes that have come online, running in their containers, but only one is about 25% busy. (And with that, when I do load testing with several of these:

riff publish -c 100000 -i base64 -d some_great_string_to_base64_encode -r

it predictably takes quite a long time to service 100000 requests...)

I'm not sure if this is a parallelism problem because gRPC is not implemented in the invoker server?

I'm looking for more developer docs on Riff but I'm not seeing lots of guidance for function invoker developers. (I think I'll go try some of the other invokers to see if I get the same behavior. That way I'll know if it's the way I'm using riff, or if there's something wrong with the invoker...)

I'm thinking about that strange keyword I didn't understand in the conference video, "Reactive Flux" and that's about the point where my eyeballs glazed over...

@kingdonb
Copy link

I seemed to get the same problem from the nodejs invoker that has lots of contributions, so I'm willing to chalk it up to "I'm using RIFF wrong"

So where does one go these days to get learnt about advanced use cases of Riff? Should I be seeking someone out on IRC to explain Reactive Flux or is there a nice blog post?

(If one is out there, I couldn't find it / it didn't talk specifically about Riff)

@kingdonb
Copy link

kingdonb commented Jul 29, 2018

Long story short, the "failure to spread traffic" issue I was seeing in 0.0.7, has been dispatched and wiped out by 0.1.0 release.

Today you need to edit the invokers map in https://github.com/projectriff/riff/blob/master/cmd/commands/function.go#L53-L55 and compile your own CLI binary if you want to bring your own invoker, sounds like this will be fixed soon, but it is easy enough, and the Invoker yaml did not need to change at all. The CLI binary definitely has changed, but the yaml from my last week's tag is still good without any modification.

https://github.com/kingdonb/ruby-function-invoker/raw/v0.0.4/ruby-invoker.yaml

I doubt that it is actually being loaded into the cluster API as a CRD/Invoker resource anymore, but it can still be used with the newer version!

@fbiville
Copy link
Contributor

The current plan to support other languages is best described in #1093. Feel free to comment there for further discussion.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants