Git Product home page Git Product logo

Comments (16)

rabbah avatar rabbah commented on May 21, 2024 1

You can try the approach outlined here (once you have a binary you can create an action from it).

EDIT: apparently forgot to provide the link. Thanks @csantanapr (See below).

from openwhisk.

csantanapr avatar csantanapr commented on May 21, 2024 1

@rabbah you meant to share this link Understanding and using Docker actions in IBM Bluemix OpenWhisk that explains how to create a zip with a binary exe so @firasalmanna can use it to create an exec with python.

from openwhisk.

rabbah avatar rabbah commented on May 21, 2024 1

Want to reach out to us on http://slack.openwhisk.org and we can work through it directly?

from openwhisk.

tybritten avatar tybritten commented on May 21, 2024

The interesting part will be handling the requirements compiling. Lambda currently punts on this and requires users to upload all the packages (compiled) as part of their code. The problem is if I'm a mac user and compile lxml, it won't run on lambda because it's Amazon Linux. At the most basic level, having whisk run a 'pip install' (maybe even create a virtualenv) of a requirements.txt to get/compile required actions for the user would be big. That's basically what cloud foundry does in it's python buildpack.

from openwhisk.

ioana-blue avatar ioana-blue commented on May 21, 2024

I think we can close this for now. Python has been working with basic tests for a while.

from openwhisk.

csantanapr avatar csantanapr commented on May 21, 2024

@ioana-blue Could you respond to the comment #16 (comment)
from @vmtyler about how "handling the requirements compiling"?

from openwhisk.

ioana-blue avatar ioana-blue commented on May 21, 2024

For now, our solution is similar to the javascript one. We support a series of packages that are (should be) documented. At some point, we may consider a more generalized solution similar to "build packs". @vmtyler

from openwhisk.

falmanna avatar falmanna commented on May 21, 2024

Hello,
Is it possible to use packaged python actions? if yes, any tutorials?

from openwhisk.

rabbah avatar rabbah commented on May 21, 2024

@firasalmanna not an official solution yet. One option is compiling the python to a native binary which you can do with bbfreeze or maybe grumpy (https://github.com/google/grumpy)`. Which packages are you looking at?

from openwhisk.

falmanna avatar falmanna commented on May 21, 2024

@rabbah
I am trying to upload a project I am working on, requirements file attached. the requirements can be reduced as I am dividing my app into microservices, so each will have a subset of these requirements.
So after compiling my app into binary, how am I going to upload it? I don't think I saw this option in the docs.

requirements.txt

from openwhisk.

falmanna avatar falmanna commented on May 21, 2024

Hello guys,
I am having a problem after generating an executable and pushing it to openwhisk.

1- I made and executable out of my python app, I tested it locally and then tried to create an openwhisk action from it using the steps in the blog post. When I tried to invoke it, I got the message [Errno 2] No such file or directory
2- I tried to create a docker image, I used dockerskeleton as the base image, I copied my exec to action/exec, I built the image and pushed it, then why I invoked the openwhisk action created from my image, I also received the same error [Errno 2] No such file or directory.

I browsed the docker image files, and I found the exec file in the action directory.
Do you have an idea what could be the problem?

from openwhisk.

rabbah avatar rabbah commented on May 21, 2024

If you can exec into the container, did you run the /action/exec directly to confirm it works?

from openwhisk.

falmanna avatar falmanna commented on May 21, 2024

No, I couldn't run it, I also got No such file or directory
And after some investigation, I think that the executable I generate using pyinstaller is 32-bit because pyinstaller generates 32-bit executable for python 2.7, which I am using.

Then, I found that I can execute 32 on 64 bit if there is the dynamic loader /lib/ld-linux.so.2. But I couldn't find it for alpine-linux using apk add.

The only options I have now is to find a different package for alpine that executes 32-bit, or to try to generate a 64-bit exec again.

from openwhisk.

csantanapr avatar csantanapr commented on May 21, 2024

@firasalmanna what about using the approach of using bash script exec and then from bash script and then tun setup/unit and run python script (i.e. Not compiled)

Maybe I missed that you already tried this.

from openwhisk.

rabbah avatar rabbah commented on May 21, 2024

Here's another tip following Carlos: you can use this approach with nodejs actions. That is build your binary using the nodejs actio base image if it helps and then call it from a node action.

from openwhisk.

falmanna avatar falmanna commented on May 21, 2024

@csantanapr no I didn't try this approach. I might give it a try.

But first I am thinking if trying the approach from this link https://github.com/iainhouston/dockerPython
He is renamed his python script test.py to exec, and he put it in the action directory, and everything else is the same. He also copied all his other classes to the action directory.
Do you think this should work?

@rabbah do you mean running my script from nodejs? or using this approach to run a nodejs app?

from openwhisk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.