You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwhisk.apache.org by OpenWhisk Team Slack <ra...@apache.org> on 2019/03/28 07:30:22 UTC

[slack-digest] [2019-03-27] #random

2019-03-27 14:45:31 UTC - Michele Sciabarra: any rubyst who can help me ?
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553697931337400
----
2019-03-27 15:53:44 UTC - Carlos Santana: @Justin Halsall ^^
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553702024337900
----
2019-03-27 16:06:40 UTC - Justin Halsall: @Michele Sciabarra I’m just grabbing a sandwich, I can help you in 10 minutes or so Michele
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553702800339200
----
2019-03-27 16:15:16 UTC - Michele Sciabarra: great
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703316339500
----
2019-03-27 16:15:56 UTC - Michele Sciabarra: in short I  am writing the actionloop tutorial and I picked as an example... fixing the ruby runtime
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703356340400
----
2019-03-27 16:17:33 UTC - Michele Sciabarra: I need to recode in ruby this:
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703453340900
----
2019-03-27 16:17:45 UTC - Michele Sciabarra: ```
from __future__ import print_function
from sys import stdin
from sys import stdout
from sys import stderr
from os import fdopen
import sys, os, json, traceback

# now import the action as process input/output
from main__ import main as main

env = os.environ
out = fdopen(3, "wb")
while True:
  line = stdin.readline()
  if not line: break
  args = json.loads(line)
  payload = {}
  for key in args:
    if key == "value":
      payload = args["value"]
    else:
      env["__OW_%s" % key.upper()]= args[key]
  res = {}
  try:
    res = main(payload)
  except Exception as ex:
    print(traceback.format_exc(), file=stderr)
    res = {"error": str(ex)}
  out.write(json.dumps(res, ensure_ascii=False).encode('utf-8'))
  out.write(b'\n')
  stdout.flush()
  stderr.flush()
  out.flush()
```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703465341100
----
2019-03-27 16:17:53 UTC - Michele Sciabarra: You know as you did in crystal...
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703473341500
----
2019-03-27 16:18:01 UTC - Michele Sciabarra: hmmm let me see if I can reuse that code...
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703481341900
----
2019-03-27 16:18:55 UTC - Michele Sciabarra: wow looks almost valid ruby code
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703535342200
----
2019-03-27 16:20:53 UTC - Michele Sciabarra: I think it is missing this:
```
  payload = {}
  for key in args:
    if key == "value":
      payload = args["value"]
    else:
      env["__OW_%s" % key.upper()]= args[key]
```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703653342500
----
2019-03-27 16:21:43 UTC - Michele Sciabarra: your code is only:
```
 payload = {} of String =&gt; String
  if args["value"]?
    payload = args["value"]
  end
```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703703343000
----
2019-03-27 16:24:43 UTC - Justin Halsall: yeah its pretty much valid ruby with a couple exceptions here and there (the ? at the end of args["value"] isn't necessary)
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703883343800
----
2019-03-27 16:25:13 UTC - Michele Sciabarra: yes and it is missing the env variables
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703913344500
----
2019-03-27 16:26:08 UTC - Michele Sciabarra: if you fix it and give me ruby code I write in the tutorial (and I subnit also actionloop for ruby 2.6 as the performances of 2.5 are embarrassing)
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703968345800
----
2019-03-27 16:26:22 UTC - Justin Halsall: ```env["__OW_#{key.upcase}"] = args[key]```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553703982346000
----
2019-03-27 16:29:12 UTC - Michele Sciabarra: ```
args = JSON.parse(line)
  payload = {}
  for key in args
    if key == "value"
      payload = args[key]
    else
      env["__OW_#{key.upcase}"] = args[key]
    end
  end
```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704152346200
----
2019-03-27 16:29:14 UTC - Michele Sciabarra: ?
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704154346400
----
2019-03-27 16:29:31 UTC - Michele Sciabarra: I am guessing :slightly_smiling_face:
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704171346600
----
2019-03-27 16:34:05 UTC - Justin Halsall: you are a natural Michele, excellent guess!
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704445347100
----
2019-03-27 16:34:51 UTC - Justin Halsall: let me double double check that
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704491347300
----
2019-03-27 16:36:44 UTC - Michele Sciabarra: one of the things I like more of OpenWhisk is that I can code pieces in different languages and experiment.. without risking the court-martial of your project
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704604348300
----
2019-03-27 16:37:44 UTC - Justin Halsall: yes its nice, no boss yelling at you that they have no one else that can maintain this "experiment" you did in a different language
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704664349000
----
2019-03-27 16:39:31 UTC - Michele Sciabarra: basically in every enviroment if you use language not officially "adopted" you are in a huge trouble because of the huge overhead to adding the runtime
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704771350100
----
2019-03-27 16:39:50 UTC - Michele Sciabarra: this is not true only in openwhisk so far
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704790350600
----
2019-03-27 16:40:31 UTC - Michele Sciabarra: and I am building a website with openwhisk on purpose done one piece in java another in python a third in js and enjoying the mix
yay : Rodric Rabbah
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553704831351200
----
2019-03-27 16:46:48 UTC - Michele Sciabarra: Just I need to flush stdio and std err
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705208352200
----
2019-03-27 16:46:49 UTC - Michele Sciabarra: also
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705209352500
----
2019-03-27 16:46:54 UTC - Michele Sciabarra: out.puts(res.to_json)
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705214352700
----
2019-03-27 16:46:58 UTC - Justin Halsall: ```
  args = JSON.parse(line)
  payload = {}
  args.each do |key, value|
    if key == "value"
      payload = value
    else
      env["__OW_#{key.upcase}"] = value
    end
  end```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705218353000
----
2019-03-27 16:47:10 UTC - Justin Halsall: that should work perfectly for you @Michele Sciabarra
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705230353300
----
2019-03-27 16:48:11 UTC - Justin Halsall: oh wait we can do this better
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705291353500
----
2019-03-27 16:48:14 UTC - Justin Halsall: let me edit it
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705294353700
----
2019-03-27 16:48:33 UTC - Justin Halsall: done
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705313354000
----
2019-03-27 16:49:15 UTC - Michele Sciabarra: LOL (I did the same already) :smile:
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705355354300
----
2019-03-27 16:49:38 UTC - Michele Sciabarra: the flush?
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705378354500
----
2019-03-27 16:50:16 UTC - Michele Sciabarra: another probelm:
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705416354700
----
2019-03-27 16:50:17 UTC - Michele Sciabarra: launcher.rb:25:in `&lt;main&gt;': uninitialized constant IO::FileDescriptor (NameError)
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705417354900
----
2019-03-27 16:50:19 UTC - Michele Sciabarra: for
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705419355100
----
2019-03-27 16:50:28 UTC - Michele Sciabarra: ```
out = IO::FileDescriptor.new(3)
```
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705428355300
----
2019-03-27 16:54:10 UTC - Justin Halsall: yeah we need to find the ruby equivalent, I actually used to have it
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705650355700
----
2019-03-27 16:54:13 UTC - Justin Halsall: let me try and find it
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553705653355900
----
2019-03-27 17:13:31 UTC - Justin Halsall: `IO.new(3)` yields `The given fd is not accessible because RubyVM reserves it (ArgumentError)`
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553706811356500
----
2019-03-27 17:13:38 UTC - Justin Halsall: not quite sure how to get around that
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553706818356700
----
2019-03-27 17:17:56 UTC - Michele Sciabarra: File.for_fd(3) worked
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707076357100
----
2019-03-27 17:18:00 UTC - Michele Sciabarra: done!
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707080357300
----
2019-03-27 17:18:11 UTC - Michele Sciabarra: Now I have to complete the kit
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707091357500
----
2019-03-27 17:18:20 UTC - Michele Sciabarra: thx!
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707100357700
----
2019-03-27 17:25:04 UTC - Justin Halsall: @Michele Sciabarra `IO.new(3)` does work, lets use that it's closer to Crystal
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707504358400
----
2019-03-27 17:25:25 UTC - Justin Halsall: it just always gives an error unless you are NOT piping stuff over FD 3
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707525359100
----
2019-03-27 17:25:43 UTC - Justin Halsall: totally fine and works if you are
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707543359500
----
2019-03-27 17:26:14 UTC - Michele Sciabarra: ok I use that
a
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707574359700
----
2019-03-27 17:29:05 UTC - Justin Halsall: :+1:
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707745359900
----
2019-03-27 17:29:32 UTC - Michele Sciabarra: thx I have the ruby actionloop now I can go on with the tutorial
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553707772360500
----
2019-03-27 22:46:52 UTC - Chris Wegener: quick question: my colleague and I both run ```wsk -i activation poll``` against the same instance but see different results?  any idea why please?
https://openwhisk-team.slack.com/archives/C3UDXSFA6/p1553726812361900
----