Comments (3)
Hi @swarnim-cn,
thank you for using SCAR, you can send a JSON object through API Gateway by sending it in the GET body. SCAR automatically saves the body as a file that will be reachable from the INPUT_FILE_PATH
in the script.
To store results you can create a new file in the TMP_OUTPUT_DIR
that will be uploaded to your configured S3 output bucket or, if you want to get the result directly from the HTTP request, you can simply do a cat /result/file
in your script, but remember the limitations and that the result will be encoded in base64. Documentation will be updated soon to clarify these use cases.
I hope I've been helpful. I would appreciate if you could provide me some information about the use case you want to run with SCAR, as this project is part of my doctoral thesis and I need to collect information about its usage.
Regards.
from scar.
Hi @srisco
I have mailed you regarding this on your @i3m.upv.es email id. Kindly check
Regards
from scar.
@srisco
I tried doing this in two manners:
using the -jd flag ->
I invoked the lambda function in this manner scar invoke -f test.yaml -jd '{"Name":"John", "Age"=22}'
. However, in my event object, this data is not in the form of json. The corresponding event object is this ->
{'resource': '/{proxy+}', 'path': '/launch', 'httpMethod': 'POST', 'headers': {'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/json', 'Host': 'iasduhvi21.execute-api.us-east-1.amazonaws.com', 'User-Agent': 'python-requests/2.23.0', 'X-Amzn-Trace-Id': 'Root=1-5ef22967-3f07d90438506b1459e474f3', 'X-Forwarded-For': '223.225.226.3', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https'}, 'multiValueHeaders': {'Accept': ['/'], 'Accept-Encoding': ['gzip, deflate'], 'Content-Type': ['application/json'], 'Host': ['iasduhvi21.execute-api.us-east-1.amazonaws.com'], 'User-Agent': ['python-requests/2.23.0'], 'X-Amzn-Trace-Id': ['Root=1-5ef22967-3f07d90438506b1459e474f3'], 'X-Forwarded-For': ['223.225.226.3'], 'X-Forwarded-Port': ['443'], 'X-Forwarded-Proto': ['https']}, 'queryStringParameters': None, 'multiValueQueryStringParameters': None, 'pathParameters': {'proxy': 'launch'}, 'stageVariables': None, 'requestContext': {'resourceId': '81opwu', 'resourcePath': '/{proxy+}', 'httpMethod': 'POST', 'extendedRequestId': 'OltoQHTTIAMFccQ=', 'requestTime': '23/Jun/2020:16:10:15 +0000', 'path': '/scar/launch', 'accountId': '069379984339', 'protocol': 'HTTP/1.1', 'stage': 'scar', 'domainPrefix': 'iasduhvi21', 'requestTimeEpoch': 1592928615966, 'requestId': '25828803-6a7e-41f5-99bd-cc119eb229c9', 'identity': {'cognitoIdentityPoolId': None, 'accountId': None, 'cognitoIdentityId': None, 'caller': None, 'sourceIp': '223.225.226.3', 'principalOrgId': None, 'accessKey': None, 'cognitoAuthenticationType': None, 'cognitoAuthenticationProvider': None, 'userArn': None, 'userAgent': 'python-requests/2.23.0', 'user': None}, 'domainName': 'iasduhvi21.execute-api.us-east-1.amazonaws.com', 'apiId': 'iasduhvi21'}, 'body': 'Name=John&Age=22', 'isBase64Encoded': False}
In this, the 'body' is not in json format hence it's giving me an error while executing the lambda function. 'body': 'Name=John&Age=22'
is not json format.
Using the -p flag ->
I invoked the lambda function in this manner scar invoke -f test.yaml -jd '{"Name":"John", "Age"=22}'
. This was in the correct json format. But when I checked the file corresponding to INPUT_FILE_PATH
there is nothing there so I was not able to extract these parameters.
from scar.
Related Issues (20)
- My docker image is 396MB which is <512MB still AWS cloud watch fails to execute saying No SPACE LEFT HOT 2
- Scar unable to execute AWS Lambda function using Uploaded Docker image to S3 HOT 2
- Bash script executed successfully but how do i post the results to cloudwatch HOT 5
- How can i schedule scar run -n <Function name> HOT 2
- How To Convert your "scar init -f scar.yaml" inside docker to an equivalent docker exec -it scar init -f scar.yaml file using docker-compose HOT 1
- Can I use this lambda for training? HOT 3
- Getting No logs/failures for private docker "scar init -n SREBlackBoxTester -i 8236.dkr.ecr.us-west-2.amazonaws.com/abc-gat:latest" HOT 6
- JSON object must be str, bytes or bytearray, not NoneType HOT 5
- Scar local, does not honour env variables HOT 3
- Is it possible to mount a container using tmpfs? HOT 1
- Running a script inside docker container HOT 1
- Access EFS storage from within container HOT 10
- batch processing from public bucket / subscribing to SNS topic HOT 2
- Allow creating a function inside a VPC
- Integration with Serverless
- How could the darknet example be changed if the weights, cfg, and data files were in s3?
- S3 storage not working with user-defined scripts HOT 2
- Error checking supervisor version in run command in case if image runtime
- SCAR throwing “Must specify userName when calling with non-User credentials” error when using AWS temporary credentials.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scar.