You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2021/03/15 16:14:14 UTC

[GitHub] [openwhisk] ZinuoCai opened a new issue #5092: How to create an action whose kind is `blackbox`

ZinuoCai opened a new issue #5092:
URL: https://github.com/apache/openwhisk/issues/5092


   Hello, I want to create an action whose kind is `blackbox`. I refer to the Swagger UI document and find the following data.
   ```json
   {
     "namespace": "string",
     "name": "string",
     "version": "string",
     "publish": true,
     "exec": {
       "kind": "blackbox",
       "code": "string",
       "image": "string",
       "main": "string",
       "binary": true,
       "components": [
         "string"
       ]
     },
     "annotations": [
       {
         "key": "string"
       }
     ],
     "delAnnotations": [
       "string"
     ],
     "parameters": [
       {
         "key": "string"
       }
     ],
     "limits": {
       "timeout": 60000,
       "memory": 256,
       "logs": 10,
       "concurrency": 1
     }
   }
   ```
   
   But it says that when the kind is not blackbox, we can put the code in the **code** field. I wonder how can I put my code in such a case. Thank!


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk] ZinuoCai closed issue #5092: How to create an action whose kind is `blackbox` with restful API

Posted by GitBox <gi...@apache.org>.
ZinuoCai closed issue #5092:
URL: https://github.com/apache/openwhisk/issues/5092


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk] ZinuoCai commented on issue #5092: How to create an action whose kind is `blackbox` with restful API

Posted by GitBox <gi...@apache.org>.
ZinuoCai commented on issue #5092:
URL: https://github.com/apache/openwhisk/issues/5092#issuecomment-799909701


   @rabbah Thanks for your advice.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk] ZinuoCai commented on issue #5092: How to create an action whose kind is `blackbox` with restful API

Posted by GitBox <gi...@apache.org>.
ZinuoCai commented on issue #5092:
URL: https://github.com/apache/openwhisk/issues/5092#issuecomment-799912488


   I ask the question because I want to add a gpu memory limit to the pod. I have change the code of OpenWhisk to satisfy the requirements, but I fail to create the action with openwhisk-cli because it does not support self-defined limit keywords. We can create an action with the restful API. I release my code below.
   
   ```py
   import requests
   
   code = "[your code here]"
   action_name = '[your action name]'
   img = '[docker image name]'
   # a special limit in my case
   gpu_memory = 1024
   
   headers = {
       'accept': 'application/json',
       'Content-Type': 'application/json',
   }
   
   # change the below to your identity information
   auth = ('23bc46b1-71f6-4ed5-8c54-816aa4f8c502', '123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP')
   url = 'https://127.0.0.1:31001/api/v1/namespaces/guest/actions/%s' % action_name
   
   data = """
           {
               "exec":{
                   "kind":"blackbox",
                   "image": "%s",
                   "code":"%s",
                   "binary":false
               },
               "limits":{
                   "gpuMemory": %d
               }
           }
           """ % (img, code, gpu_memory)
   
   response = requests.put(url, headers=headers, data=data, verify=False, auth=auth)
   print(response.content)
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [openwhisk] rabbah commented on issue #5092: How to create an action whose kind is `blackbox` with restful API

Posted by GitBox <gi...@apache.org>.
rabbah commented on issue #5092:
URL: https://github.com/apache/openwhisk/issues/5092#issuecomment-799716877


   Tip: You can add `-v` (or `-d`) to the `wsk` CLI command to see how the CLI is making the API calls. 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org