-
Notifications
You must be signed in to change notification settings - Fork 7
Setup Yoda Executor Using Google Cloud Function
Google Cloud Platform provides a function executor service called "Google Cloud Function". Yoda's executor runtime can be deployed on Google Cloud Function by following this instruction.
In your Google cloud platform account, go to Cloud Functions Page and click Create function.
Follow the following steps:
- Choose your Function name and Region
- Set Trigger type to HTTP
- For Authentication, choose Allow unauthenticated invocations
Scroll further to VARIABLES, NETWORKING, AND ADVANCED SETTINGS in ADVANCED section. We recommend using 1 GiB RAM and 12 seconds timeout.
Then, create new environment variables for the runtime below.
Key | Value |
---|---|
MAX_EXECUTABLE |
8192 |
MAX_DATA_SIZE |
4096 |
Click next to go to the code setting.
- Choose Runtime to
Python 3.9
- Set Entry point to
execute
- Choose Source code to
ZIP Upload
- You need to upload the runtime zip.
- For Stage bucket, if you don't have an existing stage bucket, create a new one.
Click Deploy at the bottom of the current page. If the deployment is successful, You will see the correct symbol.
Let's get Trigger URL
by clicking the function name and go to Trigger
tab.
You can test the endpoint using curl
with the following command
curl --location --request POST '<your_trigger_url>' \
--header 'Content-Type: application/json' \
--data-raw '{
"executable": "IyEvdXNyL2Jpbi9lbnYgcHl0aG9uMwoKaW1wb3J0IHN5cwoKZGVmIG1haW4oZGF0YSk6CiAgICByZXR1cm4gZGF0YQoKCmlmIF9fbmFtZV9fID09ICJfX21haW5fXyI6CiAgICB0cnk6CiAgICAgICAgcHJpbnQobWFpbigqc3lzLmFyZ3ZbMTpdKSkKICAgIGV4Y2VwdCBFeGNlcHRpb24gYXMgZToKICAgICAgICBwcmludChzdHIoZSksIGZpbGU9c3lzLnN0ZGVycikKICAgICAgICBzeXMuZXhpdCgxKQo=",
"calldata": "\"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\"",
"timeout": 3000
}'
The expected result should be:
{
"err": "",
"returncode": 0,
"stderr": "",
"stdout": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages.\n",
"version": "google-cloud-function:2.0.4"
}