apache / openwhisk-composer-python

Apache OpenWhisk Composer Python provides a high-level programming model in Python for composing serverless functions
https://openwhisk.apache.org/
Apache License 2.0
8 stars 15 forks source link

Read from file not implemented #23

Open singhsegv opened 2 months ago

singhsegv commented 2 months ago

I am trying to use this with a basic example where my composition.py file and the function program files are located in the same directory.

This is what my hello.py looks like:

def main(args):
    print("Hello")
    print(args)
    return {"key": "hello"}

And this is how my composition.py looks like:

import composer

def main():
  return composer.action("HELLO", {
        "filename": hello.py",
        "limits": {
            "memory": "128",
        }
    })

I am getting the "read from file not implemented" error.

singhsegv commented 2 months ago

I see this in line 451 composer.py

 elif 'filename' in options and isinstance(options['filename'], str): # read action code from file
        raise ComposerError('read from file not implemented')
        # exc = fs.readFileSync(options.filename, { encoding: 'utf8' })

Any specific reason for not allowing the filename option? Any workarounds?

rabbah commented 2 months ago

@singhsegv did you try using the JavaScript composer instead? This python version hasn't been maintained. You're welcome to send a PR though if you like.

singhsegv commented 2 months ago

Would love to raise a PR of this. Is there a contribution guideline or development setup guideline that you can point me to for this project?

And yeah, Javascript composer worked out for me.

rabbah commented 1 month ago

https://github.com/apache/openwhisk/blob/master/CONTRIBUTING.md mainly you need an ICLA if it's a substantial change